where()显示" IS NULL"而不是codeigniter中的变量值

时间:2018-01-02 07:38:00

标签: php mysql codeigniter

$email='abc@abc.com';
$pass= 123;
$this->db->select('*')->from('user')->where('email',$email)->where('password',$pass)-> get()->result();

这给出了结果: -

'select * from user where email IS NULL and password IS NULL';

但它适用于$this->db->query();

PLZ帮我找到为什么不采取: -

'select * from user where email="abc@abc.com" and password="123" ';

1 个答案:

答案 0 :(得分:-1)

使用此方法。希望它能帮到你

$email = "abc@example.com"; 
$password = "abc123";

public function getdata()
{
    // first load your model if not added in your config/autoload file
    return $this->db->get_where('table_name', array('email' => $email, 'password' => $password))->row_array();

}