Jump to content

Unexpected Parse Error Help


Samza

Recommended Posts

Hi,

 

I am fairly new to PHP and I can't for the life of me correct this error:

 

"Parse error: syntax error, unexpected '$username' (T_VARIABLE) in D:\Computer Forensics\xampp\htdocs\xampp\iis\php\userprofile.php on line 7"

 

Here is the corrosponding file code:

 

<?php
include 'connection.php';

?>
<?php
$username = $_SESSION['authenticatedUser'];
$query = 'SELECT firstname, surname, username, password, email, address1, address2, postcode FROM customers WHERE username='$username' LIMIT 1';
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
$username = $row['username'];
}
?>

<html>
<table border=1>
<tr>
<th>Username</th><td><input type="text" name="username" value="<?php echo $_SESSION["authenticatedUser"] ?>" /></td>
</tr>

</table>
</html>

 

I have tried using the $_SESSION variable instead of $username and alternated the quotation marks etc but it still has no affect.

 

It would be much appreciated if anyone could help me out.

 

Thanks,

Sam.

Link to comment
https://forums.phpfreaks.com/topic/271316-unexpected-parse-error-help/
Share on other sites

There is no need to display the password at any time. If a user does not remember their password, you'll need to build a password recovery tool for them.

 

And, assuming you're hashing the password (using md5() or the like), you cannot reverse it. It is a one-way hashing function.

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.