Ciao,
ho un problema con la funzione array_combine().
Dal codice sottostante creo due array $all_questions[] e $all_answers[] per poi combinarle in un'unica matrice attraverso la funzione array_combine. Quando infine creo il ciclo foreach non appare niente. La matrice combinata $unisci_arr l'ho sottoposta ad un verifica con var_dump dando come risultato bool(false).
Come mai non mostra alcun risultato?
Grazie
ho un problema con la funzione array_combine().
Dal codice sottostante creo due array $all_questions[] e $all_answers[] per poi combinarle in un'unica matrice attraverso la funzione array_combine. Quando infine creo il ciclo foreach non appare niente. La matrice combinata $unisci_arr l'ho sottoposta ad un verifica con var_dump dando come risultato bool(false).
Come mai non mostra alcun risultato?
Grazie
PHP:
<?php
$one = mysql_query("SELECT * FROM hb_pl_interview_questions ORDER BY id ASC");
$q = array();
while($row = mysql_fetch_array($one)){
$all_questions[] = $row['question'];
}
$two = mysql_query("SELECT * FROM hb_pl_interview_answers");
$a = array();
while($row = mysql_fetch_array($two)){
$all_answers[] = $row['answer'];
}
$unisci_arr = array_combine($all_questions, $all_answers);
foreach($unisci_arr as $question=>$answer){
echo $question .'<br />';
echo $answer .'<br />';
}
?>
}