ole90
08-30-2007, 10:52 PM
I'm making a user gallery of items and i want to order it by name.
The only problem is i'm getting the name of the item after i do the while.
Like:
$sel=mysql_query("SELECT * FROM `inventory`");
while($row=mysql_fetch_array($sel)) {
$itemid = $row['itemid'];
$se=mysql_query("SELECT * FROM `items` WHERE `ID` = '$itemid'") or die(mysql_error());
$f=mysql_fetch_array($se);
$itemname = $f['itemname'];
echo"$itemname<br>";
}
How would i get it to order by itemname?
The only problem is i'm getting the name of the item after i do the while.
Like:
$sel=mysql_query("SELECT * FROM `inventory`");
while($row=mysql_fetch_array($sel)) {
$itemid = $row['itemid'];
$se=mysql_query("SELECT * FROM `items` WHERE `ID` = '$itemid'") or die(mysql_error());
$f=mysql_fetch_array($se);
$itemname = $f['itemname'];
echo"$itemname<br>";
}
How would i get it to order by itemname?