update sql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
krraleigh
Forum Commoner
Posts: 86
Joined: Tue Jul 17, 2007 2:52 pm

update sql

Post 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
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Is that the ACTUAL code??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It's not in quotes... being assigned to a variable... Not hashed password...
krraleigh
Forum Commoner
Posts: 86
Joined: Tue Jul 17, 2007 2:52 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
krraleigh
Forum Commoner
Posts: 86
Joined: Tue Jul 17, 2007 2:52 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$sql = "like this";
krraleigh
Forum Commoner
Posts: 86
Joined: Tue Jul 17, 2007 2:52 pm

Post by krraleigh »

thank you
Kevin
Post Reply