i have an array like this:
$arr = (1, 3, 87, 200);
I wanna get the Object for these IDs only
ca I do it like this:
$object = new Object($arr);
foreach($object as $o)
{
$o->user->get()
}
i have an array like this:
$arr = (1, 3, 87, 200);
I wanna get the Object for these IDs only
ca I do it like this:
$object = new Object($arr);
foreach($object as $o)
{
$o->user->get()
}
You can use the where_in
method.
$arr = array(1, 3, 87, 200);
$o = new Object();
$o->where_in('id', $arr);
$o->get();
// When $o->get() is called, all records where
// the id is 1, 3, 87 or 200 will be returned
If you wanted to order them you could use the following, before calling get()
.
$o->order_by("column_1", "column_2");
For more bits you can do prior to get, see the manual page