Coder Social home page Coder Social logo

Comments (7)

davidvrsantos avatar davidvrsantos commented on June 1, 2024 1

You can use this form:

$this->users->get_many_by("collumn1 = 1 OR collumn1 = 2 OR collumn1 = 3");

this works for me!

from codeigniter-base-model.

dadenewyyt avatar dadenewyyt commented on June 1, 2024

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
#216.

from codeigniter-base-model.

tejashsoni111 avatar tejashsoni111 commented on June 1, 2024

@dadenewyyt , how to use or_where(); with get_by() or get_many() methods? Do I need to add new method for it?

from codeigniter-base-model.

dadenewyyt avatar dadenewyyt commented on June 1, 2024

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
#216 (comment)
.

from codeigniter-base-model.

gautamsawala avatar gautamsawala commented on June 1, 2024

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?

from codeigniter-base-model.

vsogrimen avatar vsogrimen commented on June 1, 2024

@gautamsawala, I think you can do that by executing two different QUERIES or by using or_where().

from codeigniter-base-model.

gautamsawala avatar gautamsawala commented on June 1, 2024

@vsogrimen do we have 'or_where()' as in built function in MY_Model? I cannot find it!

from codeigniter-base-model.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.