|
The coding is simple, I mentioned field, just to specify that Name is field of table.
The model code is
data_query (model name) and function fetch_profile($id):
$this->db->select('*')->where('Id',$id)->from('location');
$query = $this->db->get()->row_array();
return $query;
The controller code is
$this->load->model('data_query');
$page['result'] = $this->data_query->fetch_profile($id);
$this->load->view('Profile',$page);
And displaying the result
echo $result['Name'];
echo $result['Address']; etc etc
Its working fine, if the fields are not empty ,but gives error (undefined index) for empty field. Kindly need a solution.
|