Example #1
0
 /**
  * ORDER BY
  *
  * @param	string	$orderby
  * @param	string	$direction	ASC, DESC or RANDOM
  * @param	bool	$escape
  * @return	object
  */
 public function order_by($orderby, $direction = '', $escape = NULL)
 {
     $direction = strtoupper(trim($direction));
     if ($direction === 'RANDOM') {
         if (!is_float($orderby) && ctype_digit((string) $orderby)) {
             $orderby = $orderby > 1 ? (double) '0.' . $orderby : (double) $orderby;
         }
         if (is_float($orderby)) {
             $this->simple_query('SET SEED ' . $orderby);
         }
         $orderby = $this->_random_keyword[0];
         $direction = '';
         $escape = FALSE;
     }
     return parent::order_by($orderby, $direction, $escape);
 }