how to fetch and display the array value using codeigniter. I have added in view page but not getting the output.Let me know how to call a function along with value and show result again to view page
Controller.page
----------------
public function abc($id,$company)
{
$result_array['memberTo'] =$this->Admin_model->Abc($id,$company);
$this->load->view('admin_dashboard',$result_array);
}
View.page
----------------
$CI =& get_instance();
$CI->abc($name_mem,$company);
echo $memberTo[0]->name;
model.page
----------------
public function Abc($id,$company){
// echo $db_name = $company."_db";
$this->dbm = $this->load->database('$db_name', true);
$this->db->where('folio', $id);
$result = $this->db->get('members');
$data = array();
foreach($result->result() as $row) {
$data[] = $row;
}
return $data;
}
You Change in You model function and View page
try like this Model Page
public function Abc($id,$company){
// echo $db_name = $company."_db";
$this->dbm = $this->load->database('$db_name', true);
$this->db->where('folio', $id);
$result = $this->db->get('members');
$data = array();
return $result;
}
in Your View Page
$CI =& get_instance();
$CI->abc($name_mem,$company);
foreach($memberTo->result() as $row)
{
echo $row->name;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.