not able to set OR condition for query.
Is it possible to set OR condition for any query?
I need to set condition for following query : select * from users where username='abc' or email='[email protected]';
you could use active record or_where(); On Jan 6, 2016 5:02 PM, "tejashsoni111" [email protected] wrote:
Is it possible to set OR condition for any query?
I need to set condition for following query : select * from users where username='abc' or email='abc@defcom';
— Reply to this email directly or view it on GitHub https://github.com/jamierumbelow/codeigniter-base-model/issues/216.
@dadenewyyt , how to use or_where(); with get_by() or get_many() methods? Do I need to add new method for it?
I guess u need to።modify the actual code።base on. MYmodel.php other wise ur have the option to define a method inside ur model like student_model.php a function።purly apply codei።tired active record the or_where query please sear h on that. On Jan 7, 2016 8:06 AM, "tejashsoni111" [email protected] wrote:
@dadenewyyt https://github.com/dadenewyyt , how to use or_where(); with get_by() or get_many() methods? Do I need to add new method for it?
— Reply to this email directly or view it on GitHub https://github.com/jamierumbelow/codeigniter-base-model/issues/216#issuecomment-169552462 .
Can we use get_by() on email and if the returns null again make a get_by() on username?
Is this technique costly and inefficient considering the database has huge number of rows?
@gautamsawala, I think you can do that by executing two different QUERIES or by using or_where().
@vsogrimen do we have 'or_where()' as in built function in MY_Model? I cannot find it!
You can use this form:
$this->users->get_many_by("collumn1 = 1 OR collumn1 = 2 OR collumn1 = 3");
this works for me!