Get random Objects with Propel

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. public static function getRandomUsers($num=1){
  2. $c = new Criteria();
  3. $c->addAscendingOrderByColumn('rand()');
  4. $c->setLimit($num);
  5. $users = UserPeer::doSelect($c);
  6. return $users;
  7. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.