Skilled Illusionist
- Joined
- Jan 14, 2005
- Messages
- 395
- Reaction score
- 2
Hello,
I need to make overview of a question list but somehow only 'fase2' is shown while there is data for fase1 but it loads in weirdly (see code bellow), fase2 but fase1 is shown up as a large empty array while fase2 does got data?
fase1 array data
if anyone got a clue what i am doing wrong please let me know because i cant figure it out.
print_r($row); result
if something is unclear please ask,
thanks in advance.
- aristonia
I need to make overview of a question list but somehow only 'fase2' is shown while there is data for fase1 but it loads in weirdly (see code bellow), fase2 but fase1 is shown up as a large empty array while fase2 does got data?
fase1 array data
Code:
Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( )
if anyone got a clue what i am doing wrong please let me know because i cant figure it out.
Code:
echo '<table width="40%" align="center" id="vragenlijst">
<tr>
<td width="50%">Vragen</td>
<td width="10%" align="center">Fase 1</td>
<td width="10%" align="center">Fase 2</td>
<td width="10%" align="center">Fase 3</td>
<td width="10%" align="center">Fase 4</td>
</tr>';
foreach(fetchresults($naam, false) as $row){
if(!empty($row)){
print_r($row); //this does show fase1 and fase2 containing data
$fase1 = array();
$fase2 = array();
$fase3 = array();
$fase4 = array();
if($row['fase'] == '1'){
$fase1 = explode(",", $row['antwoorden']);
} elseif($row['fase'] == '2'){
fase2 = explode(",", $row['antwoorden']);
} elseif($row['fase'] == '3'){
$fase3 = explode(",", $row['antwoorden']);
}elseif($row['fase'] == '4'){
$fase4 = explode(",", $row['antwoorden']);
}
} else {
echo "Geen resultaat.";
$weergave = true;
}
}
foreach(vragenlijst(2) as $vraag){
$newvraag = explode("=", $vraag);
echo '<tr>
<td width="10%" align="left">'.$newvraag[0].'</td>
<td width="10%" align="center">'.$fase1[$i].'</td>
<td width="10%" align="center">'.$fase2[$i].'</td>
<td width="10%" align="center">'.$fase3[$i].'</td>
<td width="10%" align="center">'.$fase4[$i].'</td>
</tr>';
$i++;
}
echo '</table>';
print_r($row); result
Code:
Array ( [id] => 2 [medewerker] => 1 [antwoorden] => 1=1,2=1,3=1,4=1,5=1,6=1,7=1,8=1,9=1,10=1,11=1,12=1,13=1,14=1,15=1,16=1,17=1,18=1,19=1,20=1,21=1,22=1,23=1,24=1,25=1,26=1,27=1,28=1,29=1,30=1,31=1,32=1,33=1,34=1,35=1,36=1,37=a,38=1,39=a [fase] => 1 [date] => 2020-04-14 10:02:18 ) Array ( [id] => 3 [medewerker] => 1 [antwoorden] => 1=1,2=1,3=1,4=1,5=1,6=1,7=1,8=1,9=1,10=1,11=1,12=a,13=a,14=1,15=1,16=1,17=1,18=1,19=1,20=1,21=1,22=1,23=1,24=1,25=a,26=a,27=1,28=1,29=1,30=1,31=1,32=1,33=1,34=1,35=1,36=1,37=1,38=1,39=1,40=1,41=a,42=1,43=a,44=1,45=1 [fase] => 2 [date] => 2020-04-14 10:04:15 )
if something is unclear please ask,
thanks in advance.
- aristonia