Bonjour sur le net j'ai trouvé un scipt pour utiliser deux couleurs différente sur un tableau php pour chaque entrée, je l'ai mis en place sur mon tableau mais plus rien ne s'affiche :
alors pouvez vous m'aider à le placer correctement : voila le script trouvez sur developpez.com ;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 $compteur = 0; while(...) { $couleur = ($compteur % 2 == 0) ? '#CCCCCC' : '#FFFFFF'; echo '<tr><td bgcolor="'.$couleur.'">texte</td></tr>'; $compteur++; }
et puis voila mon tableau :
merçi pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <table><tr> <th>Modifier</th> <th>Supprimer</th> <th>Centre</th> <th>Matricule</th> <th>Grade</th> <th>Nom</th> <th>Prénom</th> </tr> <?php $retour = mysql_query('SELECT * FROM news ORDER BY centre'); while ($donnees = mysql_fetch_array($retour)) // On fait une boucle pour lister les news { ?> <tr> <td><?php echo '<a href="rediger_news.php?modifier_news=' . $donnees['id'] . '">'; ?><img src="button_edit.png"></a></td> <td><?php echo '<a href="liste_news.php?supprimer_news=' . $donnees['id'] . '">'; ?><img src="button_drop.png"></a></td> <td><?php echo stripslashes($donnees['centre']); ?></td> <td><?php echo stripslashes($donnees['matricule']); ?></td> <td><?php echo stripslashes($donnees['grade']); ?></td> <td><?php echo stripslashes($donnees['nom']); ?></td> <td><?php echo stripslashes($donnees['prenom']); ?></td> </tr> <?php } // Fin de la boucle qui liste les news ?> </table>![]()
Partager