Re: My Project
| From: | Edward Vermillion | Date: | Wed, 20 Jul 2005 15:08:03 +0000 |
| Subject: | Re: My Project | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219040@lists.php.net to get a copy of this message | ||
Matt Darby wrote:
It *is* a great book (I cut my teeth with it as well): PHP and MySQL Development (Welling and Thomson) http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glance&s=books&n=507846 Read it, learn it, live it. Matt Darby Jay Blanchard wrote:Honestly, the best "book" I read when I was starting out, and one I've been using ever since, is the manual. I actually spent $ on a very good php book but I think I've only cracked the cover on it once or twice in two years. Way to go manual guys! :D[snip][/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 INTOHey, Look I made a new database just for this money testing stuff. This is the table: CREATE TABLEmoney(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.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 = "UPDATEmoneySETmoney= (money-10) WHEREcharacterName=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 = "UPDATEmoneySETmoney= (money-10) WHEREcharacterName=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!