Boucle pour parcourir une table
Bonjour,
Je souhaite parcourir entièrement une table (albums) et récupérer pour chaque nom d'artiste les albums trouvés.
J'ai donc testé 2 requêtes :
Code:
1 2 3 4 5 6 7 8 9
|
$req = "SELECT ALBUM.*, ARTISTE.* FROM ARTISTE, ALBUM WHERE ARTISTE.NUM_ART = ALBUM.NUM_ALB AND ARTISTE.NOM_ART = '$nom'";
$res = mysql_query ($req) or die ("Erreur requête");
$req1=mysql_query("SELECT COUNT(*) as total FROM ALBUM");
while($ligne = mysql_fetch_array($req1))
$total = $ligne['total'];
$nom=$_GET['art']; |
$total devant me renvoyer le nombre total de lignes de la table Album.
J'ai donc implanté le code suivant :
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 27 28 29 30 31 32 33
|
<?php
for ($i=1; $i=$total; $i++) {
if ($tab['$i'] = mysql_fetch_array($res)){
$alb=$tab['NOM_ALB'];
echo '
<table>
<tr>
<td>
<img src="' . $tab['IMAGE_ALB'] . '">
</a>
</td>
<td width="125">
<a href="chronique.php?art=' . $alb .'">' . $alb . '</a>
<br>
' . $tab['GENRE_ALB'] . '
<br>
' . $tab['DATE_ALB'] . '
</td>
</tr>
</table>' ;
}
}
?> |
La boucle for semble ne pas marcher, j'ai le message d'erreur suivant :
Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\Siteweb\chroniques.php on line 144 (ligne du for)
Quelqu'un peut-il m'éclairer un peu ?