Skip to content

Instantly share code, notes, and snippets.

@jordanthomas
Created September 1, 2011 15:29
Show Gist options
  • Save jordanthomas/1186425 to your computer and use it in GitHub Desktop.
Save jordanthomas/1186425 to your computer and use it in GitHub Desktop.
Kohana random record method
public function find_random()
{
$row = DB::query(Database::SELECT,
'SELECT * FROM `'.$this->table_name.'` ORDER BY RAND() LIMIT 1')
->as_object(get_class($this))->execute($this->_db)->current();
return $row;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment