Re: remove from db renumbering
| From: | Adam Royle | Date: | Mon, 01 Jul 2002 03:27:56 +0000 |
| Subject: | Re: remove from db renumbering | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20227@lists.php.net to get a copy of this message | ||
You should not rely on the autonumber as a sorting method. You should use it
as a reference. I see you have two easy options (there may be more, but this
seems suitable).
1. Get the SQL to pull a random record (requires mySQL 3.23.x or higher)
SELECT * FROM tblName ORDER BY RAND() LIMIT 1
2. Get all of the ID numbers into an array and pick a random value, then
retrieve the rest of the details using the row ID you picked from the array.
Adam