|
Posted by Frankie on 11/19/39 11:56
Hi,
I need to add shirt size info for new T-shirts into a mysql database in this
order: S, M, L, XL, creating the following table:
itemNumber size inStock
1000 S Y
1000 M Y
1000 L N
1000 XL Y etc...
Now, when I read the data back out, it'll be presented in logical
order. My queries are in sequential order by size, as follows:
if ($_POST['radioSmall'])
{
$size = "S";
$Squery = sprintf("INSERT INTO inStockApparel (itemNumber, size, inStock)
VALUES ('%s', '%s', '%s')",
$_POST['hfItemNumber'],
$size,
$_POST['radioSmall']);
$Sresult = mysql_query($Squery) or die(mysql_error());
}
if ($_POST['radioMedium'])
{
$size = "M";
$Mquery = sprintf("INSERT INTO inStockApparel (itemNumber, size, inStock)
VALUES ('%s', '%s', '%s')",
$_POST['hfItemNumber'],
$size,
$_POST['radioMedium']);
$Mresult = mysql_query($Mquery) or die(mysql_error());
}
etc....
But this results in random entries by size.
Is there a way to order these entries? If not, how would I use usort() to
get the order I want?
Frank H.
Austin, TX
Navigation:
[Reply to this message]
|