php - Echo mysql query -


i using following function in 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() $rows)         {             //add data 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 enter details should not fail. there no db error, have debug turned on.

question: possible echo query being sent can see trying , why failing.

yes..

try this

 echo $this->db->last_query(); 

after make query....

this print query last made..

so if want last query,do

 $query=$this->db->get("users");  echo $this->db->last_query(); 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -