Jump to content

Unexpected Parse Error Help


Recommended Posts



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:


include 'connection.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'];

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



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.




Link to comment
Share on other sites

Thanks mate! I'm also looking to display the user's password however I have multiple encryption's with a salt on it. Would I have to create a reverse function to display it in the form for them to edit, or should I not show their password for safety?

Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

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

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.