i'm trying to insert values into my database that contain a variable
that gets incremented by one for each item in a shopping cart.
item_name becomes item_name1, item_name2, item_name3, and so on for
the total number of items in the cart.
this code works great when i only have one shopping cart item to deal
with.
$sql = mysql_query("IN SERT into PPorder_details
(txn_id, productID)
VALUES
('$txn_id', '$item_number') ");
for multiple cart items, here is my code:
if($num_cart_it ems) {
for($i = 1; $i <= $num_cart_items ; $i++) {
// loop thru cart and add "$i" to item_name
$sql = mysql_query("IN SERT into PPorder_details
(txn_id, productID)
VALUES
('$txn_id', '$(item_number$ i)')");
}
}
i have tried numerous different iterations, none of which evaluate the
string correctly and insert the proper value.
please help! i am a newbie, and this is beyond me.
thank you,
jean
that gets incremented by one for each item in a shopping cart.
item_name becomes item_name1, item_name2, item_name3, and so on for
the total number of items in the cart.
this code works great when i only have one shopping cart item to deal
with.
$sql = mysql_query("IN SERT into PPorder_details
(txn_id, productID)
VALUES
('$txn_id', '$item_number') ");
for multiple cart items, here is my code:
if($num_cart_it ems) {
for($i = 1; $i <= $num_cart_items ; $i++) {
// loop thru cart and add "$i" to item_name
$sql = mysql_query("IN SERT into PPorder_details
(txn_id, productID)
VALUES
('$txn_id', '$(item_number$ i)')");
}
}
i have tried numerous different iterations, none of which evaluate the
string correctly and insert the proper value.
please help! i am a newbie, and this is beyond me.
thank you,
jean
Comment