2008年04月22日

Just a quicky, as I had to spend 10 mins looking this up hopefully it’ll save someone else time later.

I need to retrieve a random user from the users table, but didn’t know how to express a random record… this method will return a single random user, or can take an argument to return more than 1
UserPeer

	public static function getRandomUsers($num=1){		$c = new Criteria();		$c->addAscendingOrderByColumn('rand()');		$c->setLimit($num);		$users = UserPeer::doSelect($c);		return $users;		}
2008年04月16日