$client_list = mysql_query("SELECT * FROM clients"); while($row = mysql_fetch_array($client_list)){ echo "<a href='client.php?id=" . $row['client_id'] . "'>"; echo "<div id='client'><div id='name'>" . $row['client_name'] . "</div>"; if($row['client_r'] != 0){echo "<div id='r'>R</div>";} if($row['client_s'] != 0){echo "<div id='s'>S</div>";} if($row['client_d'] != 0){echo "<div id='d'>D</div>";} echo "</div></a>"; }
Sorting Mysql List
Sorting Mysql List
Ive got a mysql table with a load of clients listed. The below script echos out each of them perfectly except I would like them to be sorted alphabetically. How can I do this with what I already have?
Re: Sorting Mysql List
You simply have to add to your query
ORDER BY `name` DESC