hello,
I tried myself for 6 to 7 hours continuously and now after getting my mind fuse, i'm writing here.
I've designed a shopping cart (cart.php).
If user presses UPDATE button on cart, it'll be re-directed to cart_update.php where quantities has to be updated.
My problem is that i don't know how to update all item's qty.
cart may have 2 items or 10 items.
Cart fetches detail including qty from database.
I'm very new in PHP so perhaps this will be very stupid question.
Thanks in advance.
quantity in shopping cart
Moderator: General Moderators
Re: quantity in shopping cart
I hope this will work for you:
Code: Select all
<?php
$con = mysql_connect("localhost","microboy","m123456789");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
mysql_query("UPDATE Items SET quantity = '36'
WHERE ItemName = 'Book' ");
mysql_close($con);
?>-
imran.rajani
- Forum Newbie
- Posts: 16
- Joined: Tue Dec 22, 2009 5:34 pm
Re: quantity in shopping cart
i'm sorry if not mentioned problem clearly.MicroBoy wrote:I hope this will work for you:
Code: Select all
<?php $con = mysql_connect("localhost","microboy","m123456789"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); mysql_query("UPDATE Items SET quantity = '36' WHERE ItemName = 'Book' "); mysql_close($con); ?>
i've a form contained qty "textbox" which populates using while.
means if i've 10 items in table 'db_cart', there'll be 10 qty fields on cart.php
how i can call these html textboxes to cart_update.php because they're generated dynamically not statically.
Thanks