title: Displaying data from a database table based on id of user logged in
body: <p>I'm trying to get certain information from a database according to the user that's logged in. Right now I can get information from the columns and rows but its not user specific. Can I use a <code>$_SESSION</code>? Would that work in the <code>$query</code>?</p>
  
  <p>PHP:</p>
  
  <pre><code>$query = "SELECT * ".
  "FROM leavetable, users ".
  "WHERE leavetable.users_id = users.id ";
  
  $result = mysql_query($query) or die(mysql_error());
  while($row = mysql_fetch_array($result)){
      echo ' &lt;tr&gt; ';
      echo ' &lt;td&gt; ';
      echo $row['id'];
      echo ' &lt;td&gt; ';
      echo $row['hours'];
      echo ' &lt;td&gt; ';
      echo $row['email'];
      echo ' &lt;td&gt; ';
      echo $row['username'];
      echo ' &lt;td&gt; ';
  }
  </code></pre>