spode Posted May 30, 2007 Share Posted May 30, 2007 Still gettin' a MySQL syntax error: <?php case 'edit': if (isset($_POST['submit'])) { $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>"; } } else { $query = "SELECT * FROM tbl_users WHERE (uid=$uid)"; $r = mysql_query ($query); $list = mysql_fetch_array($r); echo "<h1>Edit Information</h1> <form action=\"crud.php?action=edit\" method=\"post\"> <table> <tr> <td>Username:</td> <td><input type=\"text\" name=\"uname\" value='{$list['username']}' size=\"20\"></td> </tr> <tr> <td>New Password:</td> <td><input type=\"password\" name=\"npass\" value='{$list['password']}' size=\"20\"></td> </tr> <tr> <td>Verify Password:</td> <td><input type=\"password\" name=\"vpass\" size=\"20\"></td> </tr> <tr> <td><input type=\"submit\" name=\"submit\" value=\"Update\"> </form> </table>"; } break; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53630-oh-noes/ Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 Whats the error? Quote Link to comment https://forums.phpfreaks.com/topic/53630-oh-noes/#findComment-265088 Share on other sites More sharing options...
spode Posted May 30, 2007 Author Share Posted May 30, 2007 Information failed to update because 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 Quote Link to comment https://forums.phpfreaks.com/topic/53630-oh-noes/#findComment-265090 Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 $insertinfo = "UPDATE `tbl_users` SET `username`='$uname', `password`='$npass' WHERE `uid`='$uid'"; Try that out, if that does not work do this: echo "Information failed to update because " . mysql_error() . "<br /> FROM SQL : " . $insertinfo; Report back what that turns up. Quote Link to comment https://forums.phpfreaks.com/topic/53630-oh-noes/#findComment-265099 Share on other sites More sharing options...
spode Posted May 30, 2007 Author Share Posted May 30, 2007 The back ticks worked, thanks Quote Link to comment https://forums.phpfreaks.com/topic/53630-oh-noes/#findComment-265101 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.