well I'm not too happy with the way I did it cos the db gets queried 26 times in the process....but I was in a real hurry to do it.
$var[0] = "a";
$var[1] = "b";
$var[2] = "c";
etc...
$var[25] = "z";
$x=0;
while($x<25){
$sql=mysql_query("SELECT * FROM $table WHERE title LIKE '$var[$x]%' LIMIT 1");
while($row=mysql_fetch_aray($sql))
{
$title = substr($row[title],0,1);
print ("<a href=\"#\">$title</a> ");
$x++;
}
}
It isn't ideal because if a letter isn't found then it won't be displayed...whereas the real way would be to display the letter but not have it as a link.
surely the better way is to query the db only once and then have some function that sifts through each record and displays each letter only once.....? But I was in a real hurry.
cheers,
Scott D~