Я пытаюсь отобразить результат запроса к базе данных в своем контроллере, но не знаю, как это сделать. не могли бы вы мне показать?
Контроллер
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'];
}
Моя модель
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;}
}
Подробнее здесь: https://stackoverflow.com/questions/106 ... controller