Reply to Re: Help please with the dreaded what if question

Your name:

Reply:


Posted by Rik on 05/28/06 14:47

Dynamo wrote:
> Hi again,
> I am constructing a site on a small scale where people can buy nik
> naks and pay for them via paypal. Everything works fine unless there
> is only one of an item left for sale. What if 2 people try to buy
> this item at the same time?
> I have partially overcome this problem by adding an extra column
> called status to my catalogue table. When somebody tries to buy the
> item I have created an interim page where the user is asked to
> confirm his purchase before sending the info to paypal and I have
> inserted an update query that changes the status from "available" to
> "pending sale" on this page.

I expect you keep the data of (to be) purchased items in some kind of
session.
If you choose to store this session in the database instead of the default
handler:
- You could check wether a product is available by looking at stock minus
the amount in the (several) session.
- Other people will immediately see that an item is out of stock, or perhaps
"reserved" if you choose to.
- As soon as their purchase is aborted or time out after a arbitrary amount
of time, items are available again.

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация