[eluser]tuckee[/eluser]
Hi guys, I am trying to convert the admin login username I got from the session into admin ID.
What I am trying to do here is I call the search_admin_id function in my model and return the id and store in $admin_id.
I got the error of "undefined variable : data" in my models/admin_model.php
My Controller
Code:
function approval()
{
$this->load->model('Admin_model');
$admin_username = $this->session->userdata('admin_username');
$admin_id = $this->Admin_model->search_admin_id($admin_username);
}
My admin_model class
Code:
function search_admin_id($admin_username)
{
$query_str = "SELECT admin_id FROM admin WHERE admin_username = ?";
$query = $this->db->query($query_str, $admin_username);
if($query -> num_rows() > 0 )
{
return $data;
}
}
Can anyone help me? Any help is much appreciated.