Jump to content

Recommended Posts

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;
?>

Link to comment
https://forums.phpfreaks.com/topic/53630-oh-noes/
Share on other sites

$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.

Link to comment
https://forums.phpfreaks.com/topic/53630-oh-noes/#findComment-265099
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.