So here is the error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: idnum
Filename: models/model_teacher.php
Line Number: 8
this is my controller:
public function teacher(){
$this->load->model('model_teacher');
$data['result'] = $this->model_teacher->scoreboard();
$this->load->view('teacher/teacher', $data);
}
and my model:
class Model_teacher extends CI_Model {
public function scoreboard() {
$this->db->where('login_id', $this->input->post('idnum'));
$query = $this->db->query("SELECT * FROM teacher WHERE login_id = '".$idnum."'");
return $query->result();
}
}
and the view:
<?php
foreach ($result as $row) {
echo $row->login_id."<br>";
echo $row->lname."<br>";
}
?>
and don't know what is wrong with this code. please bear with me, i'm still a newbie at using codeigniter. thanks guys.