Jump to content


Photo

*SOLVED* parse error, unexpected T_ENCAPSED_AND_WHITESPACE.....


  • Please log in to reply
2 replies to this topic

#1 essjay_d12

essjay_d12
  • Members
  • PipPipPip
  • Advanced Member
  • 121 posts

Posted 14 March 2006 - 03:42 PM

The following error appeared on the line under the error comment ... i cant see whats wrong

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

<?php
if (isset($_SESSION['username'])) {
//open connection
$conn = mysql_connect("localhost", "admin", "adm1n");
mysql_select_db("project",$conn);


//error on next line
$query = "SELECT F_NAME, L_NAME FROM users WHERE USERNAME = '$_SESSION['username']'";


$result = mysql_query($query) or die(mysql_error());
$rows = mysql_num_rows($result);

while ($row = mysql_fetch_assoc($result)) {
   echo ($row['F_NAME']);
   echo " ";
   echo ($row['L_NAME']);

}
if (!isset($_SESSION['username'])) {

echo "Please Sign in or ";
echo "<a href=register.php>Register</a>";
} 
?>


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 March 2006 - 03:50 PM

change

$query = "SELECT F_NAME, L_NAME FROM users WHERE USERNAME = '$_SESSION['username']'";

to

$query = "SELECT F_NAME, L_NAME FROM users WHERE USERNAME = '$_SESSION[username]'";


that should do the trick.. :)
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 essjay_d12

essjay_d12
  • Members
  • PipPipPip
  • Advanced Member
  • 121 posts

Posted 14 March 2006 - 03:58 PM

Now it says that on the last line of the file i have the following error...

Parse error: parse error, unexpected $end

but there is nothing on the last line!!

Found it

had missing bracket

thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users