1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| $critere = '';
$sous_critere = '';
echo '<table>';
while ($ligne = mysql_fetch_array($result_query))
{
//si nouveau critere, on l'affiche
if ($critere != $ligne['critere'])
{
echo '<tr><td colspan="3">'.$ligne['critere'].'</td></tr>';
$critere = $ligne['critere']; //on mémorise le critère
}
//si nouveau sous-critere, on l'affiche
if ($sous_critere != $ligne['sous_critere'])
{
echo '<tr><td colspan="3">'.$ligne['sous_critere'].'</td></tr>';
$sous_critere = $ligne['sous_critere'];//on mémorise le sous-critère
}
//on affiche la ligne de résultat
echo '<tr><td>'.$ligne['question'].'</td><td>'.$ligne['reponse'].'</td><td>'.$ligne['remarque'].'</td></tr>'
}
echo '</table>'; |
Partager