Page 1 of 1

unexpected T_Variable Issue

Posted: Mon May 11, 2009 10:45 am
by ProductManager
Getting this error:Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/content/l/a/b/laborchamp/html/RecoverPassword.php on line 28
I am stumped as I have no blank spaces and I think the code is clean. Thanks in advance for any thoughts.

Code: Select all

<?php
// MySQL Information.
$db_host = "localhost"; // Host, 99% of the time this is localhost.
$db_username = "username"; // Username here
$db_password = "password"; // Password here
$linkID = @mysql_connect("$db_host", "$db_username", "$db_password");
// email sent from form 
$myemail=$_POST['email']; 
// query commands
mysql_select_db("laborchamp", $linkID) or die(mysql_error()); // Database here
$resultID = mysql_query("SELECT user FROM lcuser WHERE email = '$myemail'", $linkID) or die(mysql_error());
// End of query commands
// Check if Email is in database
$num_rows = mysql_num_rows($resultID); 
$row = mysql_fetch_array($resultID); 
$user_id = $row[0];
if ($user_id == "") {
print "We're sorry, your Email does not appear to be in our database.";
}
else {
// query commands
$resultID = mysql_query("SELECT Password FROM lcuser WHERE Email = '$email'", $linkID) or die(mysql_error());
$row = mysql_fetch_array($resultID); 
$passwordfromdb = $row['Password'];
echo $passwordfromdb
// End of query commands
// Send Password to email
$subject = 'Your Password';
$headers = 'webmaster@thing.com';
mail($myemail, $subject, $passwordfromdb, $headers); 
echo "Your Password has been sent to $myemail.";
}
// End of Send Password to email
mysql_close($linkID);
?>

Re: unexpected T_Variable Issue

Posted: Mon May 11, 2009 10:51 am
by divito
Missing a semicolon on line 25.

Re: unexpected T_Variable Issue

Posted: Mon May 11, 2009 10:52 am
by codex-m
ProductManager wrote:Getting this error:Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/content/l/a/b/laborchamp/html/RecoverPassword.php on line 28
I am stumped as I have no blank spaces and I think the code is clean. Thanks in advance for any thoughts.
I think you forgot to place a comma after the echo statement such as below:

Wrong:

Code: Select all

 
echo $passwordfromdb
 
Correct:

Code: Select all

 
echo $passwordfromdb;