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."';"; 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' 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 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? 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 Link to comment https://forums.phpfreaks.com/topic/40631-syntax/#findComment-196549 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.