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.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.