hi,
i trying to make on albhabet like address book,means if there is record start with that particalur letter than there will be link other wise letter without link. But it is not making links for all records.
$sql="SELECT Left(ucase(name),1) AS myalphabet, Count(*) AS mycount FROM mytable GROUP BY Left(ucase(name),1)";
$result=mysql_query($sql,$link);
$asciiStart=65;
$asciiEnd=90;
while($row=mysql_fetch_array($result)){
if( (ord($row['myalphabet'])) == $asciiStart ){
print "<a href='alphabetlisting.php?st=".$row['myalphabet']."'>".$row['myalphabet']."</a>";
}
else
{
print (" ".chr($asciiStart)." ");
}
$asciiStart=$asciiStart+1;
}
while($asciiStart <= $asciiEnd){
print (" ".chr($asciiStart)." ");
$asciiStart=$asciiStart+1;
}
Thanks