| | |
Weird Database Changing
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2006
Posts: 20
Reputation:
Solved Threads: 0
Ive got the code:
[php]mysql_query("UPDATE members SET gold=gold+$sellprice WHERE email='$player[email]' ")or die(mysql_error());[/php]
To add gold to a users account in the database but this doesn't work every time I run the script instead of adding on the new value to the old one it just
sets the gold to zero, ive tried echoing $sellprice and it does contain values and Ive checked the database and everything is valid.
Any ideas?
[php]mysql_query("UPDATE members SET gold=gold+$sellprice WHERE email='$player[email]' ")or die(mysql_error());[/php]
To add gold to a users account in the database but this doesn't work every time I run the script instead of adding on the new value to the old one it just
sets the gold to zero, ive tried echoing $sellprice and it does contain values and Ive checked the database and everything is valid.
Any ideas?
•
•
Join Date: Jul 2004
Posts: 494
Reputation:
Solved Threads: 21
This is really a SQL question... It's best asked at the SQL forum.
I think your problem is here, though:
Get gold from the database first, do the math, then set gold='$newgoldamount'
At least that's how I'd do it...
I think your problem is here, though:
PHP Syntax (Toggle Plain Text)
SET gold=gold+$sellprice
Get gold from the database first, do the math, then set gold='$newgoldamount'
At least that's how I'd do it...
www.uncreativelabs.net
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
![]() |
Similar Threads
- Problem connecting to the database after changing the database server (ASP.NET)
- Modify data in Datagrid (VB.NET)
- phpBB to php-nuke integration help (PHP)
- help with database assignment (Java)
Other Threads in the PHP Forum
- Previous Thread: Need help with forum mailing
- Next Thread: data output
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





