Pour voir si j'y arrivais encore (visiblement non) je me suis essayer a un autre tableau un poile plus complexe juste qu'il y a le nombre d'index qui varie plus.
le 1er tableau que j'ai fais qui fonctionne bien est :
[code<?php
$tabh = array ("PRENOM", "AGE", "ANNÉE", "NOTE", "COMMENTAIRE") ; //tête du tableau
//contenu du tableau
$name = array("jeanne", "alice", "chloé", "valerie", "auredy", "julie", "alice", "marie") ;
$age = array("16", "20", "27", "22", "24", "41", "19", "X") ;
$annee = array("2011", "2013", "2015", "2015", "2015", "2016", "2016", "2016") ;
$note = array("5", "6,5", "3", "3", "7", "5 ", "7", "5") ;
$com = array("VIDE", "VIDE", "VIDE", "VIDE", "VIDE", "VIDE", "VIDE", "VIDE") ;
?>
<body>
<table border=1>
<!-- boucle pour afficher chaque élément de l'entête du tableau--!>
<tr><?php for( $j=0; $j<5; $j++ ) { echo "<th>$tabh[$j]</th>"; } echo "</tr>"; ?>
<!-- boucle pour afficher chaque élément du contenu du tableau --!>
<?php for($z=0;$z<8;$z++){ ?>
<tr> <?php echo "<td> $name[$z] </td>"
. "<td> $age[$z] </td>"
. "<td> $annee[$z] </td>"
. "<td> $note[$z] </td>"
. "<td> $com[$z] </td> </tr>" ; }
?>
</table>][/code]
Et le deuxieme tableau qui a l'affichage n'en fait qu'à ça tête il ne me mais pas les elements comme il faut comme dans mon 1er tableau et je ne comprend pas pourquoi malgrer que j'ai lu quelque article sur les tableaux.
:
Code : Tout sélectionner
<?php
$presentation = array ("Jeu","Version","Note/10");
$jeu = array ("Call Of Duty ","Battle field");
$version = array ("ModerneWarFar_1","WorldAtWar","ModerneWarFar_2","BlackOps_1","ModerneWarFar_3","1943","3","4");
$note = array ("9","9","8","8","7","7","8","7");
?>
<body>
<table border = 1>
<tr><?php for($j=0;$j<3;$j++){ echo "<th>$presentation[$j]</th>"; } ?></tr>
<tr><?php for($k=0;$k<2;$k++){ echo "<td>$jeu[$k]</td>"; } ?></tr>
<tr><?php for($l=0;$l<7;$l++){ echo "<td>$version[$l]</td> " .
"<td>$note[$l]</td>";} ?></tr>
</table>