Hello,
I am making a website where you can buy some goods online. I am avoiding putting a shopping cart since it seems complicated and people are going to only be able to buy one type of product at a time, but any quantity of it.
So right now, people go to the site and select how many, say, apples they want. The website searches and sees that there are 5 apples available and they could buy it. Once they buy it, the script goes into the table and subtracts 5 apples from the quantity remaining.
What I'm thinking could be a problem is that if 2 people are browsing the site at the same time, they could get a confirmation saying that there are apples available and then by the time they pay, the apples are gone. I know on ticketmaster, what they do when you want a ticket is give them to you for 5 minutes. But how would that work. You'd have two values in the table, actual apples remaining and temporary apples remaining. So when people search it goes off the temp value. But how do I make it when someone doesnt buy to add back the apples to the temp? Do I need a cron job for that or can PHP help me.
Thanks