spode Posted May 30, 2007 Share Posted May 30, 2007 Meh...\ heres 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 '' at line 1. I get these all the friggin' time. ??? <?php $uname = $_POST['uname']; $npass = $_POST['npass']; $vpass = $_POST['vpass']; if ($vpass == $npass) { $insertinfo = "UPDATE tbl_users SET username='$uname', password='$npass' WHERE uid=$uid"; if (mysql_query($insertinfo)) { echo "Information successfully updated!"; } else { echo "Information failed to update because " . mysql_error(); } } else { echo "Your passwords did not match. Please <a href=\"crud.php?uid={$list['uid']}&action=edit\">try again</a>"; } ?> that's not the whole code but it's enough to figure it out Quote Link to comment https://forums.phpfreaks.com/topic/53547-mysql-syntax-error/ Share on other sites More sharing options...
trq Posted May 30, 2007 Share Posted May 30, 2007 password is a reserved word in sql. Either change the field name, or surround it with backticks. $insertinfo = "UPDATE tbl_users SET username='$uname', `password`='$npass' WHERE uid=$uid"; Quote Link to comment https://forums.phpfreaks.com/topic/53547-mysql-syntax-error/#findComment-264621 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.