title: CODEIGNITER undefined index
body: <p>:D
  got some problems here</p>
  
  <p>error code</p>
  
  <p>A PHP Error was encountered</p>
  
  <p>Severity: Notice</p>
  
  <p>Message: Undefined index: DESCRIPTION</p>
  
  <p>Filename: views/dashboard_view.php</p>
  
  <p>Line Number: 13</p>
  
  <p>the controller:</p>
  
  <pre><code> function index()
   {
     if($this-&gt;session-&gt;userdata('logged_in'))
     {
       $session_data = $this-&gt;session-&gt;userdata('logged_in');
       $data['username'] = $session_data['USERNAME'];
       $data['companyid'] = $session_data['COMPANYID'];
       $data['category']=$this-&gt;main_model-&gt;get_category();
       $this-&gt;load-&gt;view('dashboard_view', $data);
  
  
     }
     else
     {
       //If no session, redirect to login page
       redirect('main', 'refresh');
     }
   }
  </code></pre>
  
  <p>model</p>
  
  <pre><code> function get_category(){
  $this-&gt;db-&gt;select('*');
  $this-&gt;db-&gt;from('view_category');
  $category=$this-&gt;db-&gt;get();
  return $category-&gt;result();
  }
  </code></pre>
  
  <p>view</p>
  
  <pre><code>&lt;h2&gt;Welcome &lt;?php echo $username; ?&gt;!&lt;/h2&gt;
  &lt;?= form_hidden ($companyid); ?&gt;
  &lt;br&gt;
  &lt;a href="login/logout"&gt;Logout&lt;/a&gt;
  &lt;? foreach($category ):?&gt;
  &lt;tr&gt;
  
      &lt;td&gt;&lt;?= $category['DESCRIPTION']; ?&gt;&lt;/td&gt;&lt;-- this is line 13
  &lt;/tr&gt;
  
  &lt;? endforeach;?&gt;
  </code></pre>