Bonjour,
Dans la FAQ j'ai trouvé "Comment alterner la couleur des tr dans un tableau ?" malheureusement je n'arrive pas à l'utiliser
mon tableau n'est pas colorisé et au-dessus j'ai un affichage de xxx fois
"$couleur = ($compteur % 2 == 0) ? "#CCCCCC" : "#FFFFFF"; echo ''; $i++;"
voici la partie de mon code concernée
j'ai certainement une erreur de syntaxe quelque part, j'ai essayé de déplacer mes balises mais c'est pire, je n'ai plus mon tableau, seulement une page blanche.
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61 ....................... $result = mysql_query($sql); if($result) { ?> <table border="1" align="center"> <tr> <th>Année</th> <th>Arrivée</th> <th>Départ</th> <th>Nb. jours</th> <th>Nom et prénom</th> <th>Prix Location</th> <th>Caution</th> <th>Lit bébé</th> <th>Linge</th> <th>Prix Total</th> <th>Somme payée</th> <th>Reste à payer</th> <th>Caution restituée</th> </tr> <?php $i = 0; while($dateloca = mysql_fetch_assoc($result)) { ?> $couleur = ($compteur % 2 == 0) ? "#CCCCCC" : "#FFFFFF"; echo '<tr bgcolor="'.$couleur.'"> <td><b><big><font color="red"><?php display($dateloca['annee']); ?></font></big></b></td> <td><?php display($dateloca['datea']); ?></td> <td><?php display($dateloca['dated']); ?></td> <td><div class="alindr"><?php display($dateloca['datediff']); ?></div></td> <td><?php display($dateloca['nom'] . ' - ' . $dateloca['prenom']); ?></td> <td><div class="alindr"><?php display($dateloca['prixlocation']); ?></div></td> <td><div class="alindr"><?php display($dateloca['caution']); ?></div></td> <td><div class="alindr"><?php display($dateloca['litbaby']); ?></div></td> <td><div class="alindr"><?php display($dateloca['linge']); ?></div></td> <td><div class="alindr"><?php display($dateloca['PT']); ?></div></td> <td><div class="alindr"><?php display($dateloca['Totalpaye']); ?></div></td> <td><div class="alindr"><?php display($dateloca['Reste']); ?></div></td> <td><div class="alindr"><?php display($dateloca['restitution']); ?></div></td> </tr>'; $i++; <?php } ?> </table> ................................
D'avance merci pour votre aide toujours aussi précieuse![]()
Partager