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

 

 

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.