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?
Controller
 function get_name($id){
 $this->load->model('mod_names');
 $data['records']=$this->mod_names->profile($id);
// I want to display the the query result here 
 // like this:  echo $row ['full_name'];
 }
My Model
function profile($id)
    {  
        $this->db->select('*');
        $this->db->from('names');
        $this->db->where('id', $id); 
        $query = $this->db->get();
        if ($query->num_rows() > 0)
        { return $query->row_array();
        }
        else {return NULL;}
    }   
                echo '<pre>';
print_r($data['records']);
or
 echo $data['records'][0]['fullname'];
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With