Ibshas25 Posted December 6, 2010 Share Posted December 6, 2010 cant work out this mysql syntax error "operation":"medupdate","medid":"","name":"ibo","medyear":"5","medmonth":"21","medday":"1","recuser":1,"SuccFail":"fail","SuccFailMessage":"error occured 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 '''WHERE med_id=' at line 2","ResultData":""} $sql="update metodology set med_description='".$req['name']."', med_year='".$req['medyear']."', med_month='".$req['medmonth']."', med_day='".$req['medday']."', med_recorddate= now(), med_recorduserid= 1'"; $sql.= " WHERE med_id=".$req['medid']; Link to comment https://forums.phpfreaks.com/topic/220819-errorright-syntax-to-use-near-where-med_id-at-line-2resultdata/ Share on other sites More sharing options...
devilinc Posted December 6, 2010 Share Posted December 6, 2010 remove the single quote before you append to sql variable $sql="update metodology set med_description='".$req['name']."', med_year='".$req['medyear']."', med_month='".$req['medmonth']."', med_day='".$req['medday']."', med_recorddate= now(), med_recorduserid= 1'"; after 1 just remove the single quote i.e. $sql="update metodology set med_description='".$req['name']."', med_year='".$req['medyear']."', med_month='".$req['medmonth']."', med_day='".$req['medday']."', med_recorddate= now(), med_recorduserid= 1"; Link to comment https://forums.phpfreaks.com/topic/220819-errorright-syntax-to-use-near-where-med_id-at-line-2resultdata/#findComment-1143569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.