ellegua220 Posted March 14, 2011 Share Posted March 14, 2011 There is an error in this update statement. Here is the 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 'WHERE user.userid = 209 set user.username='ttttt', email='akegncnc@ial.com', fir' at line 1 here is the code: $query = sprintf("UPDATE user LEFT JOIN parent_user ON parent_user.userid = user.userid LEFT JOIN parent ON parent.parent_id = parent_user.parent_id WHERE user.userid = $userid set user.username='$username', email='$email', first_name='$first_name', last_name='$last_name', password='$password',phone='$phone', street_address='$street_address', other_address='$other_address', city='$city', state='$state', zipcode='$zipcode', type='$type', school='$school', school_district='$school_district',double_gui='$double_gui',status_id=$status_id,notes='%s',parent.parent_first_name='$parent_first_name',parent.parent_last_name='$parent_last_name' where userid=$userid", mysql_real_escape_string($notes, $mysql_link)); Quote Link to comment https://forums.phpfreaks.com/topic/230586-error-in-update-statement-can-anyone-tell-me-what-is-wrong/ Share on other sites More sharing options...
ellegua220 Posted March 14, 2011 Author Share Posted March 14, 2011 the where clause was out of place i think?? Quote Link to comment https://forums.phpfreaks.com/topic/230586-error-in-update-statement-can-anyone-tell-me-what-is-wrong/#findComment-1187339 Share on other sites More sharing options...
kickstart Posted March 14, 2011 Share Posted March 14, 2011 Hi You appear to have 2 separate where clauses. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/230586-error-in-update-statement-can-anyone-tell-me-what-is-wrong/#findComment-1187346 Share on other sites More sharing options...
fenway Posted March 14, 2011 Share Posted March 14, 2011 And SET needs to come earlier in the syntax. Quote Link to comment https://forums.phpfreaks.com/topic/230586-error-in-update-statement-can-anyone-tell-me-what-is-wrong/#findComment-1187369 Share on other sites More sharing options...
kickstart Posted March 14, 2011 Share Posted March 14, 2011 And SET needs to come earlier in the syntax. Depends which of the wheres are deleted . All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/230586-error-in-update-statement-can-anyone-tell-me-what-is-wrong/#findComment-1187377 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.