note 61084 deleted from function.rand by felipe
| From: | felipe@php.net | Date: | Sun, 09 Dec 2007 15:38:59 +0000 |
| Subject: | note 61084 deleted from function.rand by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133024@lists.php.net to get a copy of this message | ||
Note Submitter: AlieN
----
About selecting random row from a MySQL table (much faster thand MySQL's rand function:
$tot=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM
sometable WHERE
(condition)"));
$row=rand(0,$tot);
$res=mysql_fetch_row(mysql_query("SELECT * FROM sometable WHERE (condition) LIMIT
$row,1"));