Résultat de requête dans une boucle
bonsoir,
voilà j'ai un probleme je n'arrive pas a faire une boucle qui me retourne quelque chose comme ça :
Citation:
note numero 1 = 20
note numero 2 = 12
note numero 3 = 13
note numero 4 = 12
voilà ce que j'ai fais :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <?php
$nbnotea = "SELECT COUNT(*) note FROM notes WHERE notes.NoMatieres=1";
$nbnotea2 = mysql_query($nbnotea);
$nbnotesanglais = mysql_fetch_row($nbnotea2);
do
{
$i=1;
$n=$nbnotesanglais[0];
echo " note numero $i = ".$note[0];
echo '<br />';
}while(($note = mysql_fetch_array($resultat, MYSQL_BOTH)) && ($i<$n));
ou cette boucle
while ($note = mysql_fetch_array($resultat, MYSQL_BOTH))
{
for($i=1; $i<$n ; $i++)
{
echo " note numero $i = ".$note[0] ;
echo '<br />';
}
}
?> |
je sais pas du tout comme faire...
merci de votre aide