title: PHP Sessions "SELECT * from users where username = '".$_SESSION['user']."'";
body: <p>I have set up a login script which seems to work fine</p>
  
  <p>The problem im having is the code below is not working:</p>
  
  <pre><code>session_start(); 
  
  $sql = "SELECT * from users where username = '".$_SESSION['user']."'";
  
  while( $row = mysql_fetch_assoc($query) )
  {
      echo "&lt;tr&gt;&lt;td&gt;$row[username]&lt;/td&gt;";
      echo "&lt;td&gt;$row[email]&lt;/td&gt;";
      echo "&lt;td&gt;$row[id]&lt;/td&gt;";
  }
  </code></pre>
  
  <p>if i output </p>
  
  <pre><code>session_start(); 
  Print_r ($_SESSION);
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>Array ( [user] =&gt; Array ( [id] =&gt; 1 [username] =&gt; craig [email] =&gt; craig@craig.com ) ) 
  </code></pre>