Alecdude Posted December 17, 2008 Share Posted December 17, 2008 Ok, I'm a bit lost. The code: if ($_POST['Submit']=='Update') { $profile = $_POST['Desc']; mysql_query("UPDATE users SET Desc='".$Desc."' WHERE id=".$_SESSION['user_id']."") or die(mysql_error()); header("Location: myaccount.php?msg=Profile Description Updated!"); } And it generates this 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 'Desc='Testing, 123 testing...' WHERE id=47' at line 1 Help? Link to comment https://forums.phpfreaks.com/topic/137299-solved-syntax-error-in-updating-script/ Share on other sites More sharing options...
premiso Posted December 17, 2008 Share Posted December 17, 2008 Desc is a reserved word. Encapsulate it in backticks(`) or better yet change that column name. if ($_POST['Submit']=='Update') { $profile = $_POST['Desc']; mysql_query("UPDATE users SET `Desc`='".$Desc."' WHERE id=".$_SESSION['user_id']."") or die(mysql_error()); header("Location: myaccount.php?msg=Profile Description Updated!"); } Link to comment https://forums.phpfreaks.com/topic/137299-solved-syntax-error-in-updating-script/#findComment-717363 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.