decrementing values in data base

Reply

Join Date: Aug 2005
Posts: 3
Reputation: jody is an unknown quantity at this point 
Solved Threads: 0
jody jody is offline Offline
Newbie Poster

decrementing values in data base

 
0
  #1
Dec 10th, 2005
Hi I want to know how i can decrement the value of quantity in stock in my data base. This would be based on how times an item is purchased.

So every time an item is clicked, i want to show the quantity has decreased in the database.

Pls help.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 2
Reputation: Nicodemas is an unknown quantity at this point 
Solved Threads: 1
Nicodemas Nicodemas is offline Offline
Newbie Poster

Re: decrementing values in data base

 
0
  #2
Dec 11th, 2005
Originally Posted by jody
Hi I want to know how i can decrement the value of quantity in stock in my data base. This would be based on how times an item is purchased.

So every time an item is clicked, i want to show the quantity has decreased in the database.

Pls help.

Well, when the hyperlink is clicked, whatever page the hyperlink goes to should contain something like this:

1. a connection string to your data base.

2. an SQL statement:

UPDATE [your table's name] SET [in-stock quantity fieldname] = ([in-stock quantity fieldname] - 1) WHERE [unique key fieldname] = [unique key value].

So... if your table was named "products" let's do an example:

UPDATE products SET InStockQty = (InStockQty - 1) WHERE productID = 3


get it?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC