Here\'s an idea if you hadn\'t thought of it already. To get this result easily. Make a new column in the table. Name it \"letter\" or something similar. Make the type \"char\". Next extract the first letter from the name you inserted into the database and put it into the column \"letter\". For instance.
Say I wanted the name of the people who start with the letter a.
(Example. The first letter in the name Alex is a) So I put a in the letter column.
--Information in database--
id name letter
1 Alex a
2 Ashley a
3 Adam a
4 Chris c
5 Daniel d
--INformation in database--
Now when I want to display the names of the people whose name starts with \"a\" I use this code.
$query = \"select name from people where letter = \'a\'\";
$result = mysql_query($query) or die(\"Failure to select data.\");
while(list($name) = mysql_fetch_row($result))
{
print(\"$name<br>\");
}
And voila the names will print.
--Result of page--
Alex
Ashley
Adam
--Result of page--
I did this kinda quick so you\'re going to have to tweak anything I missed. Hope this helps.