title: How to select data from a database where userid is equal to a session variable
body: <p>I'm trying to select a row using a session variable which is already defined, but when I try it comes up with the error:</p>
  
  <blockquote>
    <p>Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
    expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or
    number (T_NUM_STRING) in viewmybookings.php on line 9</p>
  </blockquote>
  
  <p>I  have tried defining the session variable as a PHP variable and using the PHP variable however it still doesn't work</p>
  
  <pre><code>&lt;?php
  //first connect to the the database via your connection insert file
    include'db.php';
      $sql = "SELECT lesson.LessonName,lesson.LessonType,bookingtable.LessonDate,bookingtable.LessonStartTime,bookingtable.Duration,bookingtable.Statues FROM lesson
  JOIN bookingtable
  ON bookingtable.LessonID=lesson.Id
  JOIN users
  ON users.UserID = bookingtable.UserID
  WHERE users.UserFirstName = &lt;?php $_SESSION['UserID']?&gt;";
  //line 9 is the last line
  ?&gt;
  </code></pre>