Posted by CyberDog on 06/24/05 13:09
I am making an quiz script, and I cam accross a problem:
example:
I have a database that holds 10 questions.
User is given only 5 random questions.
How do I make sure that the same question is not displayed twice?
I use $question = rand(1, $number) where $number is mysql_num_rows of
the question database.
so I have a
while($position < $displayed_questions)
{
$question = rand(1, $number);
// database query stuff
// template loading stuff
$display .= $question
$position++;
}
But no way to make sure that the same question isn't taken twice...
Any ideas? :(
[Back to original message]
|