Latest news
Home » zendframework » Zend framework select Query with order Random

Zend framework select Query with order Random

Use order(‘RAND()’)  in zendframework select query for fetching records in random.

$usersTable = Engine_Api::_()->getItemTable(‘user’);

$select = $usersTable->select()

->where(‘enabled = ?’, 1)

->where(‘approved = ?’, 1)

  ->order(‘RAND()’)

->limit(5);

Leave a Reply

x

Check Also

Get core settings value in social engine

Get  core settings value in social engine Engine_Api::_()->getApi(‘settings’, ‘core’)->getFlatSetting(‘core_general.uniistatsmail’, array(”));