1
zite83
Extending XoopsPersistableObjectHandler Question
  • 2010/7/22 9:54

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


Extending XoopsPersistableObjectHandler questions agin..

Example Table

(id - name - age - sex)

1 - Bob - 23 - M
2 - Susan - 12 - F
3 - Greg - 56 - M
4 - Jessica - 27 - F
5 - Sue - 32 - F
6 - Jim - 87 - M
7 - Frank - 3 - M
etc..

Now lets say this table goes all the way to 1000 rows..

Im extending XoopsPersistableObjectHandler and I want to know how to tackle this query if at all possible.

$obj_handler =& xoops_getModuleHandler('class','module');

What I want to know is there any way I can pull only rows 1,6,7,14,78,100,135,144,322?

Should I do a query for each row or is there a way to just pull those without querying all 1000+ rows?

2
trabis
Re: Extending XoopsPersistableObjectHandler Question
  • 2010/7/22 12:50

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


This should work:
$ids = array(1,6,7,14,78,100,135,144,32);
$criteria = new Criteria('id''(' implode(','$ids) . ')''IN');
$objs $obj_handler->getObjects($criteria);

3
zite83
Re: Extending XoopsPersistableObjectHandler Question
  • 2010/7/22 13:49

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


Trabis only if my brain could work at such a high level as yours :)

This works much better than the rig I made which did the same thing.

$criteria = new CriteriaCompo();

foreach (
$ID_array as $id){

     
$criteria->add(new Criteria('id'$id'='),'OR');

}
$obj $obj_handler->getObjects($criteria);


Thanks for the help!

Login

Who's Online

225 user(s) are online (151 user(s) are browsing Support Forums)


Members: 0


Guests: 225


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits