0

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.

2
Contributors
1
Reply
4
Views
11 Years
Discussion Span
Last Post by Nicodemas
0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.