unexpected T_Variable Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ProductManager
Forum Newbie
Posts: 6
Joined: Mon May 11, 2009 10:29 am

unexpected T_Variable Issue

Post 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);
?>
Last edited by Benjamin on Mon May 11, 2009 10:52 am, edited 1 time in total.
Reason: Changed code type from text to php.
divito
Forum Commoner
Posts: 89
Joined: Sun Feb 22, 2009 7:29 am

Re: unexpected T_Variable Issue

Post by divito »

Missing a semicolon on line 25.
User avatar
codex-m
Forum Newbie
Posts: 15
Joined: Sun May 10, 2009 8:08 am

Re: unexpected T_Variable Issue

Post 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;
 
Post Reply