title: Cannot use object of type stdClass as array
body: <p>I want to show all records from database..but when i want to show records the browser show error and the error is:
  "</p>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
    
    <p>Severity: Error</p>
    
    <p>Message: Cannot use object of type stdClass as array</p>
    
    <p>Filename: views/show_designation.php</p>
    
    <p>Line Number: 53</p>
  </blockquote>
  
  <p>Backtrace:
  "</p>
  
  <p>View</p>
  
  <pre><code>&lt;?php  print_r($designation); $i=1;foreach($designation as $desig): ?&gt;
                                    &lt;tr&gt;
                                         &lt;td&gt;&lt;?php echo $i; ?&gt;&lt;/td&gt;
  
                                         &lt;td&gt;&lt;?php echo $desig['name']; ?&gt;&lt;/td&gt;  This is (LINE 53)
  
                                          &lt;td&gt;&lt;a href="&lt;?php echo base_url('index.php/designation/delete_designation/'.$desig[$i]-&gt;dkey);?&gt;"&gt;&lt;input type="button" value="Delete" class="btn btn-danger"/&gt;&lt;/a&gt;
                                          &lt;td class="numeric"&gt;&lt;a id= "&lt;?php echo $desig[$i]-&gt;dkey; ?&gt;"  onclick="edit_designation('&lt;?php echo $designation[$i]-&gt;dkey; ?&gt;')" data-target="#myModal" data-toggle="modal" style="color:#ffffff;" href="#myModal"&gt;&lt;button class="btn blue" type="button"&gt;Edit&lt;/button&gt;
  
                                    &lt;/tr&gt;
                          &lt;?php $i++;endforeach;?&gt;
  </code></pre>
  
  <p>COntroller</p>
  
  <pre><code>public function get_designation()
      {
          $this-&gt;load-&gt;model('designation_model');
          $userlist=$this-&gt;designation_model-&gt;get_alldesignation_model();
          $data['designation']=$userlist;
          $this-&gt;load-&gt;view('show_designation',$data);
      }//edit_project
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>public function get_alldesignation_model()
      {
          $query = $this-&gt;db-&gt;get('designations');
          $result=$query-&gt;result();
          return $result;
      }
  </code></pre>