Am working on an online examination system. I have ordered the question output with "ORDER BY 1 ASC" and it follows as its appears in the database. But I want the output to be randomly generated so that each time the examinee logs in, different question number comes first.

Recommended Answers

Assuming your web server is running with PHP, there is a rand() function that you can use to generate a random number for each entry, and sort it by that. Here is the manual page:

Jump to Post

All 2 Replies

Assuming your web server is running with PHP, there is a rand() function that you can use to generate a random number for each entry, and sort it by that. Here is the manual page: http://php.net/manual/en/function.rand.php

since you want to create a random questionare you will need all the questions in order from min - max numbers

you will use the rand(min,max); command for this is already given By rubberman

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.