Alphabetical Order

Hi,
Please can you tell me how to sort a mysql table in alphabetical order with a space between letters so I can place back to top of page link in all done in php.

Job 1 - make a bar with the letters on it


$letters = range('a', 'z') ;
$bar = "Find by first name : " ;

foreach( $letters as $letter)
$bar .= " <a href=person.php?firstname=$letter>$letter</a> |" ;

echo '<p>' . rtrim( "|", $bar) . '</p>' . PHP_EOL ;

A table of users


people
=====
id
firstname
lastname
address
postcode
last_bath
hamster_type

Then make a page which selects user names by first letter



if( isset( $_GET['firstname'] 
     && strlen( $_GET['firstname'] === 1 ) ){
$firstname = $_GET['firstname'] ;
}else{
exit('no letter was picked, try again' );
}



// assemble your SQL statement
$sql  = "select firstname
, lastname 
from 
people 
where 
username like '$firstname&#37;' 
" ;

Thats the basics, watch out for the the quoting of like = ‘x%’, also think carefully whether you want links to usernames starting with letters which do not exist in your records, or usernames starting with a number - else how you are going to handle null records generally.