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

Posted by Joseph on 07/20/05 15:08

Jay Blanchard wrote:

>[snip]
>
>
>>>>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.
>>>>
>>>>
>[/snip]
>
>Anyone else want to go for shorter? :)
>
>The reason is George, as someone so aptly pointed out, it appears that
>you have jumped in without any basic knowledge. And thus far we have all
>been nice (because we usually get chided for our terseness). So let me
>be the first to say RTFM, STFW and STFA and get a better book such as
>PHP and MySQL Development (Welling and Thomson) or one of a dozen
>others. Google for PHP tutorials. Read them, try them, learn them. Now
>let me explain where you went wrong above....
>
>Your table needs two columns, one for money and one for characterName.
>Make money decimal(8,2) and characterName char(64) then do the following
>query
>
>INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
>'Village_Id10t');
>
>Now do a select from the table to see the values entered. See them?
>Good!
>
>Now perform the following query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Village_Id10t` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select again and look at the values, did it work? Excellent!
>Run this query;
>
>$sqlUpdate = "UPDATE `money` SET `money` =
>(`money`-10) WHERE `characterName` = `Town_Drunk` ";
>$doUpdate = mysql_query($sqlUpdate, $myConnection);
>
>Now do a select from the table and note that the value of money did not
>change. The reason is because there is no Town_Drunk in the money table.
>Does that make sense? Wonderful!
>
>
>
lol, jay that was beautiful

Both the PHP and MySQL manuals are great tools and should be consulted
first. Youe ambition is nice, but you will get nowhere if you do not
learn how to do these things on your own.
--jzf

 

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

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