codeigniter - Unable to call model function from the controller -
i having problem code, below
error follow
( ! ) fatal error: call undefined method agentie_model::get_agentii_list() in c:\wamp\…controllers\fk_controller.php on line 65
controller:fk_controller
public function __construct() { parent::__construct(); $this->load->model('agentie_model'); $this->load->model('fk_model'); } public function add2() { $this->load->model('agentie_model'); $data['principal'] = $this->agentie_model->get_agentii_list(); //here error(line 65) $this->load->view('lista_agentii', $data); }
model:agentie_model
private $_table = "agentii"; public function get_agentii_list() { $query = $this->db->get($this->_table); return $query->result(); }
view:lista_agentii
echo "lista agentii:</br>"; foreach($principal $list) { echo $list->nume_agentie; }
public function __construct() { parent::__construct(); $this->db = $this->load->database('default', true); } public function add2() { $this->load->model('agentie_model',true); $data['principal'] = $this->agentie_model->get_agentii_list(); //here $this->load->view('lista_agentii', $data); }
Comments
Post a Comment