luckyblackcat
Programmer
Hi,
I'm writing a shopping cart using Flash-php-MySQL
$username & $itemsincart are passed from Flash to this script.
I wish to echo back to Flash the four arrays at the bottom.
I am not happy that the 2 SELECT queries are correct/efficient.
It doesn't work and I've been messing with it for so long I can't think straight anymore. I need a break.
Meanwhile can anybody out there help me??
Thanks for reading this...
usual db link stuff .....
for($i=1; i<$itemsincart; $i++){
$query = "SELECT item_no FROM cart WHERE username = '$username' ORDER BY 'item_no' ASC LIMIT ($i-1),1";
$result=mysql_query($query);
$query = "SELECT * FROM `items` WHERE item_no = '$result'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$title[$i] = "$row[0]";
$price[$i] = "$row[2]";
$item_no[$i] = "$row[4]";
$status[$i] = "$row[6]";
}
echo "&title["."$i"."]="."$title[$i]&";
echo "&price["."$i"."]="."$price[$i]&";
echo "&item_no["."$i"."]="."$item_no[$i]&";
echo "&itemstatus["."$i"."]="."$status[$i]&";
}
close link ....
I'm writing a shopping cart using Flash-php-MySQL
$username & $itemsincart are passed from Flash to this script.
I wish to echo back to Flash the four arrays at the bottom.
I am not happy that the 2 SELECT queries are correct/efficient.
It doesn't work and I've been messing with it for so long I can't think straight anymore. I need a break.
Meanwhile can anybody out there help me??
Thanks for reading this...
usual db link stuff .....
for($i=1; i<$itemsincart; $i++){
$query = "SELECT item_no FROM cart WHERE username = '$username' ORDER BY 'item_no' ASC LIMIT ($i-1),1";
$result=mysql_query($query);
$query = "SELECT * FROM `items` WHERE item_no = '$result'";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$title[$i] = "$row[0]";
$price[$i] = "$row[2]";
$item_no[$i] = "$row[4]";
$status[$i] = "$row[6]";
}
echo "&title["."$i"."]="."$title[$i]&";
echo "&price["."$i"."]="."$price[$i]&";
echo "&item_no["."$i"."]="."$item_no[$i]&";
echo "&itemstatus["."$i"."]="."$status[$i]&";
}
close link ....