shine shine - 1 year ago 102
PHP Question

where in clause and query multiple IDs using FuelPHP

Model_Article::query()->where('id', 4);

I'm using FuelPHP. I have query like the above.

And I have an arrays of ID's

$ids = array(1, 2, 4, 8 ...);

How do I apply my array of id's to write this query using that format?

Thanks a lot!

Answer Source

Feed the 'IN' inside the ->where() to create an IN() clause:

Model_Article::query()->where('field_name', 'IN', array(1,2,3,4,5))->get();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download