title: Displaying data from database using Codeigniter
body: <p>I am trying to get data from a database and display it using a model, controller, and view.</p>
  
  <p>Here is my model</p>
  
  <pre><code>public function waitlist_view() {
      $data = array();
      $this-&gt;load-&gt;database();
  
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('waitlist');
      $query = $this-&gt;db-&gt;get();
  
      return $query-&gt;row();
  }
  </code></pre>
  
  <p>Here is my controller</p>
  
  <pre><code>public function waitlist() {
      $data['title']="parents_viewlist";
      //redirect if not logged in
      if(($this-&gt;session-&gt;userdata('logged_in')!= 1) &amp;&amp; ($this-&gt;session-&gt;userdata('type')!='parent')) {
          redirect('login/index');
      }
  
      $this-&gt;load-&gt;model('parents_model');
      $data['row'] = $this-&gt;parents_model-&gt;waitlist_view();
  
      $this-&gt;load-&gt;view('templates/cpsheader', $data);
      $this-&gt;load-&gt;view('templates/cpsmenu');
      $this-&gt;load-&gt;view('parents/parents_viewlist', $data);
      $this-&gt;load-&gt;view('templates/cpsfooter');
  }
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>&lt;div&gt;
  
      &lt;?php echo $row-&gt;waitlist_id; ?&gt;
      &lt;?php echo $row-&gt;ay_code; ?&gt;
      &lt;?php echo $row-&gt;school_id; ?&gt;
      &lt;?php echo $row-&gt;waitlist_status; ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>It doesnt display anything on the page when I pull it up. Any help would be appreciated!</p>