Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in path/account.php on line 31 <?php session_start(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Account Dashboard</title> </head> <body> <?php include('dbsettings.php'); $con = mysql_connect("$host","$user","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$db_name", $con); $username= $_SESSION['username']; // Editted $sql="SELECT * FROM `user` WHERE `username`='{$username}'"; $result = mysql_query("$sql"); while($row = mysql_fetch_array($result)) { echo "Welcome, "; echo $row['firstname'] . " " . $row['lastname']; echo "Account Profile: "; echo "<BR />"; echo "Account"; echo "$row['account']"; echo "Billing Address"; echo "$row['address']"; } mysql_close($con); ?> <a href="logout.php"> Log Out </a> </body> </html> PHP:
Here is the error free code. <?php session_start(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Account Dashboard</title> </head> <body> <?php include('dbsettings.php'); $con = mysql_connect($host,$user,$password); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name, $con); $username= $_SESSION['username']; // Editted $sql="SELECT * FROM user WHERE username='{$username}'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo "Welcome, "; echo $row['firstname'] . " " . $row['lastname']; echo "Account Profile: "; echo "<BR />"; echo "Account"; echo $row['account']; echo "Billing Address"; echo $row['address']; } mysql_close($con); ?> <a href="logout.php"> Log Out </a> </body> </html> PHP:
Which line is line 31? Since the interpreter ignores line endings, you could have broken the code up any number of ways. (The way I break it, there are only 30 lines.)