Sort by Alphabetical Order (solved)
Posted: Sun Jun 19, 2011 7:52 pm
How could I sort the output of this while loop by alphabetical order?
I'm sure it's pretty easy. I tried to figure it out by reading the types or sorting in the PHP manual, but I just couldn't get it to work ...
Please and thank you!
Code: Select all
<form action = "admin_panel.php" method = "post">
<br><br>
<b>Give a player an item:</b>
<br>
Username: <input type = "text" name = "username" size = "10" />
Item:
<select name="item_name">
<?php
$item_list_1 = "SELECT * from items";
$item_list_2 = mysql_query($item_list_1) or die ("System: Could not get item information.");
while($item_list_3 = mysql_fetch_array($item_list_2))
{
echo "<option>$item_list_3[name]</option>";
}
?>
</select>
Quantity: <input type="text" name="item_quantity" size = "10" />
<input type="submit" value="Submit" name="give_item">
</form>
Please and thank you!