Jump to content

Database Errors!


Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/258583-database-errors/
Share on other sites

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>";
	} 
}
?>

 

 

 

  Quote

Actually, your missing two of them. Hence it's best to format your code in a readable format.

Link to comment
https://forums.phpfreaks.com/topic/258583-database-errors/#findComment-1325490
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.