Jump to content

oh noes!


spode

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.