Page 1 of 1

update sql

Posted: Mon Jul 30, 2007 7:53 pm
by krraleigh
Can anyone tell me what the problem with this update statment is:

Code: Select all

$userName = mysql_real_escape_string($userName);
		$myPass = mysql_real_escape_string($myPass);
		$myEmail = $_POST['email'];
		$myEmail = mysql_real_escape_string($myEmail);
		
		UPDATE user //line 37
		SET username = $userName, pass = $myPass 
		WHERE email = $myEmail;
I have this error:
Parse error: syntax error, unexpected T_STRING in G:\xampp\htdocs\bethel\1purpose_bethel\forgotPass.php on line 37

Thank You
Kevin

Posted: Mon Jul 30, 2007 8:03 pm
by superdezign
Is that the ACTUAL code??

Posted: Mon Jul 30, 2007 8:04 pm
by feyd
It's not in quotes... being assigned to a variable... Not hashed password...

Posted: Mon Jul 30, 2007 8:14 pm
by krraleigh
I get the hashed password, "woops"...
However can you be a little more specific, I don't understand what your saying?
It's not in quotes... being assigned to a variable

I tried this but...

Code: Select all

$userName = mysql_real_escape_string($userName);
		$myPass = mysql_real_escape_string($myPass);
		$myEmail = $_POST['email'];
		$myEmail = mysql_real_escape_string($myEmail);
		
		UPDATE user
		SET username = '$userName', pass = '$myPass' 
		WHERE email = '$myEmail';
Kevin

Posted: Mon Jul 30, 2007 8:18 pm
by feyd
The query must be in a string or PHP will assume you're attempting to tell it to execute PHP code .. and it won't understand a single word of it.

Posted: Mon Jul 30, 2007 8:25 pm
by krraleigh
I did a search and every example I found showed me what I have.

Can you show me what it should look like?

Thank You
Kevin

Posted: Mon Jul 30, 2007 8:27 pm
by feyd

Code: Select all

$sql = "like this";

Posted: Mon Jul 30, 2007 8:33 pm
by krraleigh
thank you
Kevin