title: Trying to display user information after they login
body: <p>I'm trying to display a users information on a profile page after they get logged in. Here is the code I'm using:</p>
  
  <pre><code>&lt;?php
  require_once('connection.inc.php');
  $conn = dbConnect('read');
  // get the username's details from the database
  $sql = ("SELECT firstname, lastname FROM members WHERE username ='".$_SESSION['username']."'");
  $_SESSION['firstname'] = 'firstname';
  $_SESSION['lastname'] = 'lastname';
  // initialize and prepare statement
  $stmt = $conn-&gt;stmt_init();
  $stmt-&gt;prepare($sql);
  // bind the result,
  $stmt-&gt;bind_result($_SESSION['firstname'], $_SESSION['lastname']);
  $stmt-&gt;execute();
  $stmt-&gt;fetch();
  </code></pre>
  
  <p>The code runs without any errors but on the profile page the results get displayed as:
  firstname: firstname
  lastname: lastname</p>
  
  <p>instead of plugging in the information that was supposed to be pulled from the database. </p>
  
  <p>The display code on the profile page itself is correct, because I can set the session variables above from the user login page, and they work properly. I just don't want to be pulling in all that information at login, if the user isn't going to be doing anything with it. Thanks for any help.</p>