Re: Add or Subtract
| From: | Julien Bonastre | Date: | Thu, 19 Jan 2006 12:51:29 +0000 |
| Subject: | Re: Add or Subtract | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41075@lists.php.net to get a copy of this message | ||
Thats not even a docs question..
Thats a "have you ever even sat down at a single teaching of SQL principles or read ANY basic SQL material at all" question.
Really man. UPDATE is one of the four most common SQL standard functions you will and should know quite well.
SELECT, INSERT, UPDATE, DELETE
I'm not having a go here, but maybe you should checkout like a basics of mysql e-book or something, I've landed on some goodies in the past and they're just fantastic, I've ended up mastering SQL query construction like spelling my name now. All shapes sizes, constraints of queries and where and how to use certain functions, where to use what, aggregate functions, stats, subqueries, multiple tables,transactional locking, etc etc etc its so exciting, really.
Enjoy!!
---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- ------oOo---------------oOo------ Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 julien@the-spectrum.org www.the-spectrum.org ------oOo---------------oOo------ ----- Original Message ----- From: "David Robley" <robleyd@ozemail.com.au>
To: <php-db@lists.php.net>
Sent: Thursday, January 19, 2006 10:36 PM
Subject: Re: [PHP-DB] Add or Subtract
On Thu, 19 Jan 2006 22:55, Ed wrote:
I've been considering doing a little project for my community site which allow people to sell and buy players ... They would have a limit of 2,000,000 upon sign up .. However i'm not sure how i'd update this figure .... Say player sells for example Alan Shearer for £300,000 he'd then have 2,300,000 how would i make it add to whats in the db already? same goes for if he was sold and it went down to 1,700,000. EdYou haven't read the mysql docs much, I guess. Assuming you are storing your limit as an integer: UPDATE table SET value = value + $newamount WHERE [something to identify the record to be updated] where $newamount is the positive or negative value of the increase passed in from wherever. Cheers -- David Robley Press any key to continue or any other key to quit... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 18/01/2006