title: PHP How to select and display a row from a mysql table after a user logs in
body: <p>So I'm making a site that requires people to sign up and log in, and I was wondering how to display the user's info after they log in?</p>
  
  <p>The code for my members area page (members.php) is the following:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
  
  &lt;?
  session_start(); // the session variable in the login form is  $_SESSION['emailaddress']
  ?&gt;
  
  
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php
  
   echo "your email is... ".$_SESSION['emailaddress']; // i used only one session variable
  
   $user=$_SESSION['emailaddress'];
  
  
   $result = mysql_query("SELECT * FROM userinfo WHERE email='$user'");
  
  while($row = mysql_fetch_array($result))
    {
    echo $row['firstname'] . " " . $row['lastname'] . " " . $row['password'];   
    }
  
   ?&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>However, when i go to the members page after I log in, it only displays the user's email address in the first echo (echo "your email is... ".$_SESSION['emailaddress'];). Is something wrong with the algorithm above used to select the user's data in the row?</p>