» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2006, 04:59 PM
TRICKY TRICKY is offline
Junior Member
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
TRICKY is on a distinguished road
Default error in update

Hi guys

The code gives me this error

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' wars.score_own = 1 WHERE wars.id=26, wars.score_oppone

The Code:

$query="UPDATE played_locations AS pl,
wars AS wars
SET pl.location_id = CASE
WHEN pl.for_war=26 AND pl.round=1 THEN 3
WHEN pl.for_war=26 AND pl.round=2 THEN 3 END,
pl.opponent_score = CASE
WHEN pl.for_war=26 AND pl.round=1 THEN 73
WHEN pl.for_war=26 AND pl.round=2 THEN 78 END,
pl.own_score = CASE
WHEN pl.for_war=26 AND pl.round=1 THEN 80
WHEN pl.for_war=26 AND pl.round=2 THEN 80 END,
wars.finished = 1 WHERE wars.id =".$war_id.",
wars.score_own = ".$total_own_score." WHERE war -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-03-2006, 05:01 PM
crimson crimson is offline
Junior Member
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
crimson is on a distinguished road
Default

It looks to me as if though you I notice you have posted your PHP code which generates the SQL. Try posting an example of an actual query generated by this PHP code. (echo $query;, copy & paste here)

bye
Good luck -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  #3  
Old 08-03-2006, 05:04 PM
snorter snorter is offline
Junior Member
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
snorter is on a distinguished road
Default

I did a WHERE clause after every column i set to a value.
I think only 1 WHERE clause should be on the end.
Or maybe that wasnt the problem, Anyhow its fixed now. Here's the new query when i echo it out:

Code:

UPDATE played_locations AS pl,
wars AS wars
SET pl.location_id = CASE
WHEN pl.round = 1 THEN 1
WHEN pl.round = 2 THEN 2
END,
pl.opponent_score = CASE
WHEN pl.round = 1 THEN 2
WHEN pl.round = 2 THEN 4
END,
pl.own_score = CASE
WHEN pl.round = 1 THEN 4
WHEN pl.round = 2 THEN 5
END,
wars.finished = 1,
wars.score_own = 0,
wars.score_opponent = 0
WHERE wars.id=26

Bye and -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
update locking behavior Joiyce MySQL Forums 1 12-12-2006 04:56 AM
using triggers to update data..... Gpump MySQL Forums 1 10-31-2006 04:43 AM
to update a table?? virdee MySQL Forums 1 10-04-2006 07:18 AM
Anyone else seeing the backlinks update? rieyl Google 6 09-04-2006 12:12 PM
how to update quantity....?? Joey MySQL Forums 0 08-03-2006 09:50 AM


All times are GMT. The time now is 10:39 AM.