title: Can't display other data from the database on to webpage
body: <p>I am building a login system and I have got it to display the username and password printed on another page. However, for some reason I can't display the user's email on the page. All I want is the user logs in and in the other page it displays their username and email address from the database.</p>
  
  <p>Here's my code: usersignin.php</p>
  
  <pre><code> &lt;?php
      $host="localhost"; // Host name 
      $username="root"; // Mysql username 
      $password=""; // Mysql password 
      $db_name="membersTI"; // Database name 
      $tbl_name="users"; // Table name 
  
      // Connect to server and select database.
      mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
      mysql_select_db("$db_name")or die("cannot select DB");
  
      session_start();
  
      // username and password sent from form 
      $myusername=$_POST['myusername']; 
      $mypassword=$_POST['mypassword']; 
  
  
      if($_POST['myusername'] == "" or $_POST['mypassword'] == ""){
          echo "Empty Field";
      }
  
      $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
      $result=mysql_query($sql);
  
      // Mysql_num_row is counting table row
      $count=mysql_num_rows($result);
  
      if($count==1){
      $_SESSION['myusername']=$myusername;
      $_SESSION['mypassword']=$mypassword;
      $_SESSION['myemail']=$myemail;
  
      header("location:login_success.php");
      }
      else {
      echo "Wrong Username or Password";
      }
  
      ?&gt;
  </code></pre>
  
  <p>login_success.php</p>
  
  <pre><code>&lt;?php
  session_start();
  if(!$_SESSION["myusername"]){
      header("location:login.php");
  } else
      $user = $_SESSION['myusername'];
      $pass = $_SESSION['mypassword'];
      $email = $_SESSION['myemail'];
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;title&gt;Member's club&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="login_success.css" /&gt;
  &lt;body&gt;
  
  
  &lt;div class="table" id = "main"&gt;
      &lt;div class="row2"&gt;
          &lt;div class="cell header" id="mainstory"&gt;
              HEY! &lt;?php echo $user;?&gt;&lt;?php echo $email?&gt;
          &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;/html&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Any suggestions? It's been a year since I touched php and a lot has changed and some of them have been deprecated.</p>