title: Codeigniter : displaying query result in controller
body: <p>I am trying to display my db query result in my controller, but I don't know how to do it. could you please show me?</p>
  
  <p>Controller</p>
  
  <pre><code> function get_name($id){
  
   $this-&gt;load-&gt;model('mod_names');
   $data['records']=$this-&gt;mod_names-&gt;profile($id);
  
  // I want to display the the query result here 
   // like this:  echo $row ['full_name'];
  
   }
  </code></pre>
  
  <p>My Model</p>
  
  <pre><code>function profile($id)
      {  
  
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;from('names');
          $this-&gt;db-&gt;where('id', $id); 
          $query = $this-&gt;db-&gt;get();
  
  
          if ($query-&gt;num_rows() &gt; 0)
          { return $query-&gt;row_array();
          }
          else {return NULL;}
  
      }   
  </code></pre>