Created
September 1, 2011 15:29
-
-
Save jordanthomas/1186425 to your computer and use it in GitHub Desktop.
Kohana random record method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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