Ok, this is probably simple but I can't figure out how to do it for the life of me. In my code below, I assign questions, question IDs, and answers to different arrays. Here is the code for that:
while($query2 = $db->fetch_array($query)) {
$arrQuestionID[] = $query2['intQuestID'];
$arrQuestion[] = $query2['varcQuestion'];
$arrAnswer[] = $query2['varcAnswer'];
}
Later on down the page I have the following code that grabs how many questions are in the $arrQuestion[] array, and then randomly picks a question ID from $arrQuestionID by key.
$y = sizeof($arrQuestion);
$y--;
mt_srand((double)microtime()*1000000);
$y = mt_rand(0, $y);
$arrQuestionID[$y];
So my question is, how can I remove the question element from the $arrQuestion[] array and the question ID element from the $arrQuestionID[] array? I want to do this so that if there are 8 questions in the array and everything is randomly picked, the same question doesn't get randomly picked again.
Thanks for your help.
phreak