You are here: Re: [PHP] My Project « PHP « IT news, forums, messages
Re: [PHP] My Project

Posted by Marek Kilimajer on 07/20/05 00:49

Paul Waring wrote:
> On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:
>
>>My money is being stored in a database. And I want everythign to be in
>>PHP, no java script. And the BUY!! Button is a input button from a form. :)
>
>
> Well in that case you probably want something like this (after you've
> checked to see whether the user is logged in etc):
>
> $sql = "UPDATE users SET money = money - 10 WHERE id = " .
> $_SESSION['user_id'];

this does not check if the user has enough money. This query does:

UPDATE users SET money = money - 10 WHERE id = $_SESSION['user_id'] and
money >= 10

Then check affected rows to see if the money was actually subtructed
from the account.

 

Navigation:

[Reply to this 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

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