portabletelly Posted May 16, 2007 Share Posted May 16, 2007 Im trying to sort this dynamic select list alphabetically, but dont really have a clue how to do it? function createList(){ include("connect.php"); include("selectdb.php"); $query = "SELECT name FROM customer_tb"; $result = mysql_query($query, $link); if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); $test="while"; } } else { $test="else"; print("<option value=\"\">No users created yet</option>"); } } Quote Link to comment https://forums.phpfreaks.com/topic/51728-sort-dynamic-select-list-fuction-alphabetically/ Share on other sites More sharing options...
mlavwilson Posted May 16, 2007 Share Posted May 16, 2007 $query = "SELECT name FROM customer_tb"; $query = "SELECT name FROM customer_tb ORDER BY name"; Quote Link to comment https://forums.phpfreaks.com/topic/51728-sort-dynamic-select-list-fuction-alphabetically/#findComment-254790 Share on other sites More sharing options...
portabletelly Posted May 16, 2007 Author Share Posted May 16, 2007 Wow that was so easy. LOL i was expecting that task to be quite hard. Thanx Quote Link to comment https://forums.phpfreaks.com/topic/51728-sort-dynamic-select-list-fuction-alphabetically/#findComment-254801 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.