PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Oct 17, 2019 6:42 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Mar 02, 2010 12:51 am 
Offline
Forum Newbie

Joined: Tue Dec 22, 2009 6:34 pm
Posts: 16
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.


Top
 Profile  
 
PostPosted: Tue Mar 02, 2010 12:44 pm 
Offline
Forum Contributor

Joined: Sat Mar 14, 2009 5:16 pm
Posts: 112
I hope this will work for you:

Syntax: [ Download ] [ Hide ]
<?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);
?>


Top
 Profile  
 
PostPosted: Tue Mar 02, 2010 2:25 pm 
Offline
Forum Newbie

Joined: Tue Dec 22, 2009 6:34 pm
Posts: 16


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group