i need to run a query something similar to this
select * from users where (username='abc' or email='[email protected]') and password='123'
How to do that in codeigniter? I tried something like,
$this->db->select('*');
$this->db->from('users');
$this->db->where("email = '" . $email . "'");
$this->db->or_where("username = '" . $email . "'");
$this->db->where("password = '" . $password . "'");
$query = $this->db->get();
Here user may insert value for username as email or username. So need to check username field value both in email field and username field with password
try this
$this->db->from('users');
$this->db->where("(email = '" . $email . "' OR username = '" . $email . "') ");
$this->db->where("password = '" . $password . "'");