Hi All,

 

I want to have a series of questions that are randomized for a particular
lesson.  This part is easy.

 

I have taken the results from the db and put it in an array and then used
shuffle() to randomize the questions.

 

while($row = mssql_fetch_array($result))

{

            $id[] = $row['id'];

$ques[] = $row['question'];

}

 

srand((float)microtime()*1000000);

shuffle($ques);

 

foreach($ques as $ranQues){

            echo "<tr><td>$ranQues </td></tr>\n";

}

 

What I'm wanting to do now is to add the id for each of the questions so
that I can track which one is the correct answer and which are the
distractors.  I will have something that looks like this.

 

Foreach($ques as $ranQues){

            echo "<tr><td><a href=\"$id\">$ranQues</a></td</tr>\n";

}

 

My problem is keeping the $id with the $ranQues after I do the shuffle.

 

I think I am on a solid approach but if there is a simplier way please let
me know.

 

 

 

alex hogan

 



****************************************************************** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
****************************************************************** 


Reply via email to