Page 1 of 1

online test repeating questions

Posted: Sat Oct 09, 2010 6:54 am
by shafiq2626
Hi!
I have make an online examination application.
I have a hundreds of questions for one test. when i allocate test for the students then online test paper select 30 question one by one with ORDER BY Rand() after each 30 seconds.
Problem is that there are repeating some questions numbers of time.
How can i solve this problem my query is follow.

Code: Select all

$sqlQuery="select * from question where  qstatus = 'Active' AND testid =".$_SESSION['tid']." ORDER BY Rand() LIMIT $offset , $limit";
its primary key is qid

Please help if anyone can with thanks.

Re: online test repeating questions

Posted: Sat Oct 09, 2010 8:37 am
by twinedev
Try seeding the RAND() with the time stamp so that each time they will hopefully be different:

Code: Select all

SELECT * FROM tblWhatever ORDER BY RAND(NOW());
-GReg

Re: online test repeating questions

Posted: Wed Oct 13, 2010 8:37 am
by shafiq2626
Thanks
This has been solved by the method which you send.
thanks again