?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?decrement availability?
Author:??(---.in-addr.btopenworld.com)
Date:???03-04-04 08:20


Hi!

I'm using PHP/MySQL. I'm creating a ecommerce site and i've done the shopping cart and the order system (i.e. checkout process). I have a products table that contains a attribute called 'unitsavailable'. What i want to do is every time a person makes a purchase i want to decrement the value inside the attribute 'unitsavailable' for the specific product sold so that until it reaches 0 the system can recognise that there are no more left. If anyone can help i would apreciate it very much.

?Re: decrement availability?
Author:??(---.scpe.powergate.ca)
Date:???03-04-04 09:36

$unit--;

?Re: decrement availability?
Author:??(---.in-addr.btopenworld.com)
Date:???03-04-04 14:59


Thanks for the reply. I know how to decrement in accordance to the example you provided, but i'm trying to change the value of the stock level in my database products table after the customer completes their checkout process. Example when the customer clicks buy the value of the units in stock will change depending on the amount purchased.

?Re: decrement availability?
Author:??(---.ym.rnc.net.cable.rogers.com)
Date:???03-04-04 16:09

sorry, misread the question

update tablename set fieldname = (fieldname-1)

?Re: decrement availability?
Author:??(---.dialsprint.net)
Date:???03-05-04 09:28

update tablename set fieldname = fieldname -1 where fieldname > 0


just to insure it doesnt go negative..
you can go into even more details.

update tablename set fieldname = fieldname -1 where fieldname > 0 AND fieldname = usernames

?Re: decrement availability?
Author:??(---.in-addr.btopenworld.com)
Date:???03-06-04 05:45

Thanks bastien and Mike.

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum