Jump to content

Updating System


ImJustBrndn

Recommended Posts

I am wanting to make a system on a site that allows a bar and quantity to be updated everytime someone makes a purchase. I want to be able to set a quantity say 200 and then everytime someone completes a paypal transaction and is referred to the confirmation page the quantity goes up 1/200, then 2/200, 3/200, and so on. Could someone please give me a simple way to do this. I'm a total php newbie and the more you explain the better. Thanks in advance. More than likely I'm only going to need this for 1 product a day. Thanks again.

Brandon
Link to comment
https://forums.phpfreaks.com/topic/18784-updating-system/
Share on other sites

one method of doing this would be to have a field in your database somewhere. just a simple int column to hold the number 1 to 200.  or even a flatfile. whatever is more convenient for you.  Everytime someone makes a purchase, simply increment the number by one.  then on your page that shows the 1/200, 2/200, 3/200, etc.. all you have to do is retrieve that number.  Or if you are keeping track of purchases in a database already, and the items have unique id's, you can simply do a query to count how many were sold. 

as far as the actual code on how to do this.. well we aren't really here to write your scripts for you.  I just gave you the logic behind it, so that's a good start.  from there, you can decide whether you want to store the number in a database or in a flatfile, then read up on how to update the number in the database, or else open a flatfile and update it, etc.. you get the picture. 
Link to comment
https://forums.phpfreaks.com/topic/18784-updating-system/#findComment-81029
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.