• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net

MySQL: 2000+ returns, alphabetical sorting

Cheap Bastard

New Member
PHP:
         //Choose a game from the list of entered games
         $body.="<SELECT NAME=\"gametitle\" SIZE=20>";
         $sql = "SELECT gametitle FROM cm0";
         $result = @mysql_query("$sql",$dbconn);
         while($row = mysql_fetch_array($result)){
         $curgam=$row['gametitle'];
         $body.="<OPTION VALUE=\"$curgam\">";
         }
         $body.="</SELECT>";
Is there a way to get this to work for many many results (or maybe make it work per alphabetical letter, i suppose). If this would be a good option how'd i get the first letter of results (i could make an extra row in the MySQL database and store it in there). Still, some letters have many results, how do i get more than say 200 results (i don't know how many but i know MySQL stops returning stuff after X results).

Also, is there a way to have MySQL return results alphabetically? (would be much easier to find and select an option). Thanks!
 

ShwingHost.com

New Member
MySQL returns all rows it finds that satisfy your search criteria if you do not use "LIMIT x, y" option. So if you build your query as:
"SELECT x FROM y ORDER BY z DESC";
it will return all rows sorted alphabetically by 'z' field.
Cheers.
 
Top