Abhishek Joshi Abhishek Joshi - 3 months ago 11
MySQL Question

defined method CI_DB_mysqli_result::where()

I am novice to CI and from documentation i have put the code but i am still getting an error...


Fatal error: Call to undefined method CI_DB_mysqli_result::where() in
C:\xampp\htdocs\Nalanda_Library\application\models\SuperUserlogin.php
on line 8
my model code is like these


class SuperUserLogin extends CI_Model{
public function checkinglogin($username,$password){
$password = md5($password);
$username;
$array=array('admin_username'=>$username,'admin_password'=>$password);
$row=$this->db->get('admin')
->where($array);

if($row->num_rows()){
return $row->row->admin_user_id();
}
}
}

Answer

Use CI's getWhere function.

$query = $this->db->get_where('mytable', array('id' => $id), $limit, $offset);