4
SQL
$sql = 'SELECT * FROM '.$xoopsDB->prefix('article').' WHERE uid = 1 AND status = 1 ORDER BY created DESC LIMIT 0, 10';
with
XoopsPersistableObjectHandler $article_handler =& xoops_getmodulehandler('article', 'news');
$criteria = new CriteriaCompo(new Criteria('uid', 1));
$criteria->add(new Criteria('status', 1));
$criteria->setLimit(10);
$criteria->setStart(0);
$criteria->setSort('created', 'DESC');
$articles = $article_handler->getObjects($criteria, true);
with
RbCrudHandler $article_handler =& xoops_getmodulehandler('article', 'news');
$articles = $article_handler->where('uid = 1 AND status = 1')->order_by('created DESC')->limit(10, 0)->getObjects();
or
$article_handler =& xoops_getmodulehandler('article', 'news');
$article_handler->where('uid = 1');
$article_handler->where('status = 1');
$article_handler->order_by('created DESC');
$article_handler->limit(10, 0);
$articles = $article_handler->getObjects();
or
$condition = array();
$condition[] = 'uid = 1';
$condition[] = 'status = 1';
$article_handler =& xoops_getmodulehandler('article', 'news');
$article_handler->where($condition)->order_by('created DESC')->limit(10, 0);
$articles = $article_handler->getObjects();
or
$condition = array();
$condition[] = 'uid = 1';
$condition[] = 'status = 1';
$article_handler =& xoops_getmodulehandler('article', 'news');
$articles = $article_handler->getObjects($condition, 'created DESC', 10 ,0);
do as you like