abhishekdeveloper Posted March 9, 2012 Share Posted March 9, 2012 Dear All, I have written the following code for "Forgot Password" link on my website www.computationalphotography.in. Below is my code: <?php include_once"configure.php"; $email=$_POST['email']; $email=mysql_real_escape_string($email); if($email<>""){ $check_user_data = mysql_query("SELECT * FROM registration WHERE email = '$email'") or die(mysql_error()); if(mysql_num_rows($check_user_data) == 0) {echo '<script language="javascript">alert("This email address does not exist. Please try again.")</script>;';unset($email);} else {$row = mysql_fetch_array($check_user_data);$email=$row['email']; $to = $email; $subject = "Here are your login details . . . "; $message = "This is in response to your request for login details on www.computationalphotography.in.\nYour username is $row['email']\n.Your password is $row['password'].\n"; $headers = "From: ".$psbhostemailaddress."\r\nReply-To: ".$email; if(mail($to, $subject, $message, $headers)){echo "<center><font face='Verdana' size='2'><b><br><br><br><br><br>THANK YOU</b> <br>Your passwords are posted to your email address. Please check your mail soon.</center>";} else{echo "<center><font face='Verdana' size='2' color=red>There is some system problem in sending login details to your address. <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";} }} ?> On execution I am receiving the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/computat/public_html/forgotpassword.php on line 22 Kindly help me out! Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/258583-database-errors/ Share on other sites More sharing options...
trq Posted March 9, 2012 Share Posted March 9, 2012 Your missing a closing } on your if statement. On a side note, is there a reason you format your code so that it is hard to read? Quote Link to comment https://forums.phpfreaks.com/topic/258583-database-errors/#findComment-1325486 Share on other sites More sharing options...
trq Posted March 9, 2012 Share Posted March 9, 2012 Actually, your missing two of them. Hence it's best to format your code in a readable format. Quote Link to comment https://forums.phpfreaks.com/topic/258583-database-errors/#findComment-1325487 Share on other sites More sharing options...
abhishekdeveloper Posted March 9, 2012 Author Share Posted March 9, 2012 Thank you for your reply, I have reformatted my output and modified my code. However, I am still getting the same error which is Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/computat/public_html/forgotpassword.php on line 29 Here's my modified code: <?php include_once"configure.php"; $email=$_POST['email']; $email=mysql_real_escape_string($email); if($email<>"") { $check_user_data = mysql_query("SELECT * FROM registration WHERE email = '$email'") or die(mysql_error()); if(mysql_num_rows($check_user_data) == 0) { echo '<script language="javascript">alert("This email address does not exist. Please try again.")</script>;';unset($email); } else { $row = mysql_fetch_array($check_user_data); $email=$row['email']; } $to = $email; $subject = "Here are your login details . . . "; $message = "This is in response to your request for login details on www.computationalphotography.in.\nYour username is $row['email']\n.Your password is $row['password']"; if(mail($to, $subject, $message, $headers)) { echo "<center><font face='Verdana' size='2'><b><br><br><br><br><br>THANK YOU</b> <br>Your passwords are posted to your email address. Please check your mail soon.</center>"; } else { echo "<center><font face='Verdana' size='2' color=red>There is some system problem in sending login details to your address" <br><br> <input type='button' value='Retry' onClick='history.go(-1)'></center></font>"; } } ?> Actually, your missing two of them. Hence it's best to format your code in a readable format. Quote Link to comment https://forums.phpfreaks.com/topic/258583-database-errors/#findComment-1325490 Share on other sites More sharing options...
abhishekdeveloper Posted March 9, 2012 Author Share Posted March 9, 2012 My problem is solved. Thank you for your help . Quote Link to comment https://forums.phpfreaks.com/topic/258583-database-errors/#findComment-1325495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.