Retrieve randomly data from database

A

Anonymous

Guest
Hello
I have store in a database some question with four answers for each question.
I want retrieve randomly 20 questions from the database.
Also I have to mix the answers as I echo them out…
Do you have any idea how can I do this?

Thank you
 
No codes... figure this out :

Follow these steps and you're fine:

1. Get the total number of records you have in the table (you should have a field that contains autonumber data for later use)
2. Make variable that contains random number (1-your max record number)
3. check if the random number exists in your database, loop it until you get a valid data
3. create the query using that random variable you've made before.

done
 
Back
Top