Re: My Project
| From: | Matt Darby | Date: | Wed, 20 Jul 2005 01:40:38 +0000 |
| Subject: | Re: My Project | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219014@lists.php.net to get a copy of this message | ||
George B wrote:
Jay Blanchard wrote:Lots of extra characters in that one... try this: $q=mysql_query("update myTable set myMoney=(myMoney-10) where myCharacter='characterName'"); if(!$q){echo mysql_error();}[snip] $money -= 10; saves some chars ;) [/snip] This actually requires two trips to the database, once to get $money and once to update $money. Do it in the query instead...once..... $sqlUpdate = "UPDATEHey, Look I made a new database just for this money testing stuff. This is the table: CREATE TABLEmyDatabase.myTableSETmyMoney= (myMoney-10) WHEREmyCharacter=characterName"; $doUpdate = mysql_query($sqlUpdate, $myConnection); saves lots of characters ;)money(moneyvarchar(255) NOT NULL default '' ) TYPE=MyISAM; Now, I use this code $sqlUpdate = "UPDATEmyDatabase.myTableSETmyMoney= (myMoney-10) WHEREmyCharacter=characterName"; $doUpdate = mysql_query($sqlUpdate, $myConnection); And it should work, And it gives no error but it is not writing anything into the database.