Re: My Project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



George B wrote:

Jay Blanchard wrote:

[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 = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing anything into the database.


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();}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux