[PHP-DEV] Bug #10590: Retrieving Random Rows From: marty <email protected>
Date: 05/01/01

From: marty <email protected>
Operating system: Linux
PHP version: 4.0.5
PHP Bug Type: MySQL related
Bug description: Retrieving Random Rows

in response to some of the user contributed notes on the 'rand()' function page, a good way to pull a randmon row from a MySql database ( < ver 3.23 ) is:

SELECT field, field*rand() AS ran FROM table ORDER BY ran LIMIT 1

hope it helps.

-- 
Edit Bug report at: http://bugs.php.net/?id=10590&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>