I just now learning codeigniter and this is my
model second_con.php
class second_con extends CI_Model
{ //CI version 3.0
public function second_mod()
{
$query = $this->db->query('SELECT * FROM subdepartment');
if($query->num_rows() > 0)
{
foreach($query->result() as $rows)
{
$datas[] = $rows;
}
return $datas;
}
}
}
controllers second.php
class second extends CI_Controller {
public function index() {
$this->load-model('second_con'); //line 7
$this->load->view('home1');
}
}
after this when I try to view this page. It showing error as follows. anyone can find out where I made mistake?
A PHP Error was encountered
Severity: Error
Message: Call to undefined function model()
Filename: controllers/second.php
Line Number: 7
Backtrace: