Random content from MySql DB
am 26.08.2008 19:37:37 von joefazee
I`m creating a small application that let users take test online, the
user will login and visit the test page, questions and answers are
stored in MySql database,
i want to display each randomly without repeating.
test must to completed between some specific amount of time or else
the application will forcefully submit the form and calculated the
completed ones (Eac question come up at a time and you choose the
answer and submit, then another come show up again, just like that),
I have plan of saving user`s progress and user may continue next time
if he/she has not spent the total test time.
I need your help on how to random the questions without repeating any
and if a user may need to continue from he/her past, the random should
also exclude the past questions stored inside the user progress table.
What is your best advice, i want to start creating the mysql table soon.
Thank you
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Random content from MySql DB
am 26.08.2008 21:17:18 von Simcha
If the past questions are 1,2,3,4:
Select * from `questions` where id not in (1,2,3,4) order by RAND();
Simcha Younger
-----Original Message-----
From: A. Joseph [mailto:joefazee@gmail.com]
Sent: Tuesday, August 26, 2008 7:38 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Random content from MySql DB
I`m creating a small application that let users take test online, the
user will login and visit the test page, questions and answers are
stored in MySql database,
i want to display each randomly without repeating.
test must to completed between some specific amount of time or else
the application will forcefully submit the form and calculated the
completed ones (Eac question come up at a time and you choose the
answer and submit, then another come show up again, just like that),
I have plan of saving user`s progress and user may continue next time
if he/she has not spent the total test time.
I need your help on how to random the questions without repeating any
and if a user may need to continue from he/her past, the random should
also exclude the past questions stored inside the user progress table.
What is your best advice, i want to start creating the mysql table soon.
Thank you
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.7/1632 - Release Date: 25/08/2008
07:05
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php