I'd like to put this code in a php internal page. I can't get it work. The code should be ok, it's a phonebook script from the net. I guess it should be edited in order to work in an internal page but i have no clue what to do with it.:
<?php
for($i=0;$i<=25;$i++){
echo("<td> <A href='#A".chr(ord("A")+$i)."'>".chr(ord("A")+$i)." </a> </td");
}
?>
</tr>
<table border="0" cellpadding="0" width="600" align="left">
<?php
function connectSQL() {
global $ID,$csign;
if ($csign==1) return;
$ID=mysql_pconnect('localhost', 'user', 'pass');
mysql_selectdb("db",$ID);
$csign=1;
}
function closeSQL() {
global $ID,$csign;
if ($csign==1) mysql_close($ID);
$csign=0;
}
function query($qstr) {
global $ID,$res,$nur;
mysql_query("SET NAMES 'latin2'", $ID);
$res = mysql_query($qstr, $ID);
$nur = mysql_num_rows($res);
}
function next_row() {
global $ID,$res;
$row = mysql_fetch_assoc($res);
return $row;
}
connectSQL();
$query="select * from telszamok where '1' ORDER BY `NEV` ASC ";
query($query);
$szin=0;
// $jelen="";
$kell=0;
while($row=next_row()) {
$anc=substr($row["NEV"], 0, 1);
if ($anc!=$jelen) { $jelen=$anc; $kell=1; }
if ($szin==1) {$color="#E58354"; $szin=0;} else {$color="#CCCCCC"; $szin=1;}
$out="<tr bgcolor='$color'><td><p><b>$mhkep</b></p></td><td valign='TOP' width='30%'><p><B>";
if($kell==1) {
$out.="<A name='A".$jelen."'>";
}
$out.="<font color='#000066'>".$row["NEV"]."</font>";
if($kell==1) {
$out.="</a>";
$kell=0;
}
$out.="</b>
".$row["BEOSZTAS"]."</p></td><td valign='top'><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">";
$out.="<TR><TD ALIGN="LEFT">Mellék:</TD><TD ALIGN="LEFT"><B>".$row["MELLEK"]."</B></TD></TR>";
$out.="<TR><TD ALIGN="LEFT">Telefonszám:</TD><TD ALIGN="LEFT"><B>".$row["TELEFONSZAM"]."</B></TD></TR>";
$out.="<TR><TD ALIGN="LEFT">Mobilszám:</TD><TD ALIGN="LEFT"><B>".$row["MOBILSZAM"]."</B></TD></TR></TABLE>";
$out.="<TD valign='top'><p>Munkahely: <b>".$row["MUNKAHELY"]."</b>
";
$out.="E-mail cÃm: <a href="mailto:".$row["EMAILCIM"]."">".$row["EMAILCIM"]."</a><b></p></td></tr>";
echo($out);
}
?>
</table>














