Reply to Help please with the dreaded what if question

Your name:

Reply:


Posted by Dynamo on 05/28/06 11:07

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. There is also an if statement like:
if ($status=="pending sale"){
echo "Sorry this item is temporarily unavailable";
}
else{
?>
<form>
// Send payment to paypal
</form>
<form method="post" action="cancelpurchase.php>
// Cancel purchase
</form>
<?php
}
?>
If the user decides he doesn't want to purchase the cancelpurchase.php updates
the status to "available".

Again everthing works fine but what happens if the user doesn't choose either
option and simply closes the open window? The status remains at "sale pending"
and nobody can buy it.
Any suggestions greatly appreciated
Regards
Dynamo

[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

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