I have a problem with the use of the function array_combine. This is the script I am using
$questionSQL = mysql_query("SELECT * FROM tbl_questions ORDER BY id ASC");
$questions = array();
while($row = mysql_fetch_array($questionSQL)){
$int_q = $row['question'];
$questions[] = $int_q;
}
$answerSQL = mysql_query("SELECT * FROM tbl_answers ORDER BY id DESC");
$answers = array();
while($row = mysql_fetch_array($answerSQL)){
$int_a = $row['answer'];
$answers[] = $int_a;
}
echo '<div class="interviewBox">';
foreach(array_combine($questions, $answers) as $question => $answer) {
echo'
<p><b>'.questionName($question).'</b></p>
<p style="margin-bottom:20px;"><u>Answer:</u><br />
'.$answer.'
</p>';
}
echo '</div>';
From the database, I extract two arrays as shown above. Then when I use the array_combine nothing appears on the screen. It seems that the function does not recognize the array. I cannot understand the reason.