public function login($email,$password)
{
$query = $this->db->where(['email'=>$email,'password'=>$password])
->get('registration');
if ($query->num_rows() > 0) {
return $query->row();
}
}
我是编程新手。有语法错误。我无法理解问题的解决方案
答案 0 :(得分:0)
试试这个
public function login($email, $password)
{
$array = array('email' => $email, 'password' => $password);
$this->db->where($array);
$query = $this->db->get('registration');
if ($query->num_rows() > 0) {
return $query->row();
// return true;
}
return false;
}
通读手册codeigniter数据库库有很多功能。
http://www.codeigniter.com/user_guide/database/query_builder.html#looking-for-specific-data
关联数组方法:
$array = array('name' => $name, 'title' => $title, 'status' => $status);
$this->db->where($array)