mcmuney Posted March 1, 2007 Share Posted March 1, 2007 Can someone help me identify the syntax errors on this statement: $sql_avg = "UPDATE `sc_rate_score_avg` SET `sum_` = 'sum_' +'".$votes."', `count_` = 'count_' +'"1"' WHERE `scm_mem_id` = '".$to_id."';"; Quote Link to comment https://forums.phpfreaks.com/topic/40631-syntax/ Share on other sites More sharing options...
MadTechie Posted March 1, 2007 Share Posted March 1, 2007 i think its here +'"1"' should be +'1' Quote Link to comment https://forums.phpfreaks.com/topic/40631-syntax/#findComment-196508 Share on other sites More sharing options...
fert Posted March 1, 2007 Share Posted March 1, 2007 and you don't end queries with ;'s Quote Link to comment https://forums.phpfreaks.com/topic/40631-syntax/#findComment-196509 Share on other sites More sharing options...
mcmuney Posted March 1, 2007 Author Share Posted March 1, 2007 Bingo, the "1" was the problem. Now the problem is that it doesn't take the existing count and add 1 to but it overwrites it with a 1. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/40631-syntax/#findComment-196533 Share on other sites More sharing options...
MadTechie Posted March 1, 2007 Share Posted March 1, 2007 try this change `count_` = 'count_' +'"1"' WHERE to `count_` = (`count_` + 1) WHERE Note the ` instead of ' might also try without brackets Quote Link to comment https://forums.phpfreaks.com/topic/40631-syntax/#findComment-196549 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.