I am using the following function in a model:
function login($email,$password)
{
$this->db->where("email",$email);
$this->db->where("password",$password);
$query=$this->db->get("users");
if($query->num_rows()>0)
{
foreach($query->result() as $rows)
{
//add all data to session
$newdata = array(
'user_id' => $rows->id,
'user_name' => $rows->username,
'user_email' => $rows->email,
'logged_in' => TRUE,
);
}
$this->session->set_userdata($newdata);
return true;
} else {
}
return false;
}
When I enter the details it should not fail. There is no db error, I have debug turned on.
QUESTION: Is it possible to echo the query that is being sent so I can see what its trying to do and thus why its failing.