Re: My Project
| From: | Marek Kilimajer | Date: | Tue, 19 Jul 2005 21:49:13 +0000 |
| Subject: | Re: My Project | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219000@lists.php.net to get a copy of this message | ||
Paul Waring wrote:
On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote: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.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'];