Jump to content

Sort dynamic select list fuction Alphabetically


portabletelly

Recommended Posts

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>");
     }

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.