[eluser]bigdaddysheikh[/eluser]
Hey,
I search a query to find a matching username and password. Upon false, it should take the user back to the login page. The initial page on load should not return a value for the query because no user information exist. But yet there is a value of 1 being returned by num_row()
Code:
$this->load->model('adminmodel');
$query = $this->adminmodel->search_query('user', $_POST);
if($query->num_rows() == '1'){
$newdata = array(
'username' => $_POST['username'],
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
$this->load->view('admin/index');
}else{
$data['error'] = "The username or password is incorrect";
$this->load->view('admin/login', $data);
}
And the model function that is doing the search is:
Code:
function search_query($table, $data)
{
$query = $this->db->get_where($table, $data);
return $query;
}
how is it returning the value of 1?