title: How can I access data in my database? - CodeIgniter
body: <p>I am using CodeIgniter and have a login system. I am still fairly new with php and I am wondering  once the user is logged in, how I can access his/her data to use throughout the site? Right now I am trying to make it say welcome "username" but I dont know where the variables come from and how I should use them. Right now in my home_view.php I have: </p>
  
  <pre><code>    &lt;div class="main"&gt;
      &lt;h2&gt;Welcome &lt;?php echo $username; ?&gt;!&lt;/h2&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It throws this error: </p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined variable: username
  
  Filename: views/home_view.php
  
  Line Number: 22
  </code></pre>
  
  <p>Can someone tell me how to do this?</p>