06-10-2008, 07:24 PM
|
#6 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 1,547
Thanks: 72
|
I can only give you the theory of how I did it. This isn't because I don't want to share it, but it has too many dependencies. What I did was the following:
- Generate a random number using PHP. Select from the table where the ID is more or equal to;
- Add that selected ID to an array and execute the first query;
- When we loop again, follow the same process but append IN() to the end with the previously selected IDs;
- Keep doing this until we get the amount we require.
As this is selecting an ID, which should be the primary key, it is a much faster select than choosing a random line from the database.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|