|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10590 Retrieving Random Rows
Submitted: 2001-05-01 17:25 UTC Modified: 2001-05-01 17:37 UTC
From: marty at webmayhem dot net dot SPAMmeNOT Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: marty at webmayhem dot net dot SPAMmeNOT
New email:
PHP Version: OS:


 [2001-05-01 17:25 UTC] marty at webmayhem dot net dot SPAMmeNOT
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-01 17:37 UTC]
Not a PHP bug (but thx for the suggestion)

Jani and Derick
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 01:03:39 2023 UTC