Jump to content

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.

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.