djw821 Posted March 27, 2008 Share Posted March 27, 2008 I keep getting a parse error on this section of code but I can't seem to find it. I was hoping someone could see something I missed. Thanks //Create a new random password $p = substr( md5(uniqid(rand(),1)), 3, 10); $query = "UPDATE registration SET password=PASSWORD('$p') WHERE user_id = $uid"; $result = @mysql_query ($query); if(mysql_affected_rows()==1) Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/ Share on other sites More sharing options...
MadTechie Posted March 27, 2008 Share Posted March 27, 2008 $query = "UPDATE registration SET `password`=PASSWORD('$p') WHERE user_id = $uid"; $result = @mysql_query ($query) or die(mysql_error()); if(mysql_affected_rows()==1) add debug info also what follows the if ? Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502514 Share on other sites More sharing options...
djw821 Posted March 27, 2008 Author Share Posted March 27, 2008 What follows the if is this //Send Email $body = "Your password has been temporarily changed to '$p' Please log in using this password and your username. Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502523 Share on other sites More sharing options...
MadTechie Posted March 27, 2008 Share Posted March 27, 2008 you could be missing an { without seeing more it hard to say Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502525 Share on other sites More sharing options...
djw821 Posted March 27, 2008 Author Share Posted March 27, 2008 The Exact Error message I am getting is this Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\htdocs\forgot password.php on line 71 Entire section of code is this I have put an ** on line 71. if($un){ //Create a new random password $p = substr( md5(uniqid(rand(),1)), 3, 10); ** $query = "UPDATE registration SET password=PASSWORD('$p') WHERE user_id = $uid"; $result = @mysql_query ($query); if(mysql_affected_rows()==1) { //Send Email $body = "Your password has been temporarily changed to '$p'Please log in using this password and your username. At that time you may change your password to something you can remember."; mail($email, Your Temporary Password. ', $body 'From: admin@'); echo'<h3>Your password has been changed you will receive a new, temporary password at the email address you provided when you registered. Once you logged in with this password, you may change it by clicking the "Change Password" link.</h3>'; exit(); }else{ //Send message to error log $message = '<p><font color="yellow" size="+1">Your password could not be changed due to a system error. We apologize for any inconvenience.</font></p>'; } mysql_close(); }else{ echo '<p><font color="yellow" size = "+1">Please try again</font></p>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502533 Share on other sites More sharing options...
MadTechie Posted March 27, 2008 Share Posted March 27, 2008 change mail($email, Your Temporary Password. ', $body 'From: admin@'); to mail($email, 'Your Temporary Password. ', $body, 'From: admin@'); also you have an extra } at the end Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502547 Share on other sites More sharing options...
djw821 Posted March 27, 2008 Author Share Posted March 27, 2008 I made the changes but still have the same error. Link to comment https://forums.phpfreaks.com/topic/98206-parse-error/#findComment-502557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.