rofl90 Posted March 12, 2008 Share Posted March 12, 2008 Heres my 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 'SET name='Charlie Kirk', title='Senior Designer', about='Hi there, my name is Ch' at line 1 and the coding; $name = addslashes($_POST['name']); $title = addslashes($_POST['title']); $about = addslashes($_POST['about']); $phone = addslashes($_POST['phone']); $email = addslashes($_POST['email']); $skype = addslashes($_POST['skype']); $world = addslashes($_POST['world']); $house = addslashes($_POST['house']); $query = "UPDATE $myuser SET name='$name', title='$title', about='$about', phone='$phone', email='$email', skype='$skype', world='$world', house='$house'"; mysql_query($query) or die(mysql_error()); echo "Updated"; echo $myuser; echo "'s profile!"; Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/ Share on other sites More sharing options...
rofl90 Posted March 12, 2008 Author Share Posted March 12, 2008 bump Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/#findComment-490218 Share on other sites More sharing options...
conker87 Posted March 12, 2008 Share Posted March 12, 2008 You need a WHERE clause, it doesn't know what rows to update. $query = "UPDATE $myuser SET name='$name', title='$title', about='$about', phone='$phone', email='$email', skype='$skype', world='$world', house='$house' WHERE `column` = 'blah'"; Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/#findComment-490310 Share on other sites More sharing options...
PFMaBiSmAd Posted March 12, 2008 Share Posted March 12, 2008 It is highly likely that $myuser is empty and the query is - UPDATE SET name='$name', ... Echo your $query variable to make sure it contains what you expect. Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/#findComment-490395 Share on other sites More sharing options...
revraz Posted March 12, 2008 Share Posted March 12, 2008 Yep, two things wrong, the tablename and no WHERE function. Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/#findComment-490403 Share on other sites More sharing options...
kenrbnsn Posted March 12, 2008 Share Posted March 12, 2008 The no "where" wouldn't cause a MySQL syntax error, but the OP probably wouldn't get the results he was looking for. Ken Link to comment https://forums.phpfreaks.com/topic/95730-mysql-syntax-error/#findComment-490408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.