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

Posted by Mikey on 07/20/05 02:42

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.
>
Maybe that is because your data type is wrong? Numbers (whole ones)
should be stored as the integer datatype, otherwise math operators will
not work. Also, is "characterName" a valid row in your database, or did
you mean to do some kind of variable substitution here?

I am not being funny here George, but don't you think maybe you need to
read some kind of programming tutorial or something? Your questions
seem to indicate that you have just decided to charge headlong into a
project with very little knowledge of what it is you are undertaking.

So far you have encountered so very mild responses to your posts, but I
am sure it is only a matter of time before more and more people will
redirect your posts to /dev/null - and really, when you get to the
extremely gnarly parts of your RPG game you will find that there is very
little repsonse or no response to your questions.

Anyway, dont want to sound like I am having a go, but this list really
is for technical problems with PHP, not a replacement for the manual.

regards,

Mikey

 

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

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