ton html est mal formé.
le th c'est dans un thead, je ne sais pas trop comment c'est interprété par le navigateur dans ton cas.
Les données c'est avec des td dans le tbody.
=>
<table>
<thead>
<tr>
<th class="alignleft bold">Par mois</th>
<th class="alignCenter bold">Année en Cours</th>
<th class="alignCenter bold">Année  précédente</th>
<th class="alignCenter bold">% Evol</th>
<th class="alignCenter bold">Objectifs Année</th>
<th class="alignCenter bold">% An/Obj</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
du coup la CSS devient (pour cette partie la)
.alignLeft {
text-align: left;
}
.alignCenter{
text-align: center;
}
.bold {
font-weight: bold;
}
du coup le code devient
<table>
<thead>
<tr>
<th class="alignLeft bold">Par mois</th>
<th class="alignCenter bold">Année en Cours</th>
<th class="alignCenter bold">Année  précédente</th>
<th class="alignCenter bold">% Evol</th>
<th class="alignCenter bold">Objectifs Année</th>
<th class="alignCenter bold">% An/Obj</th>
</tr>
</thead>
<tbody>
<?php
$cf = p(odbc_result($rs, 'EvolAnnee_1_2_2'));
$cf2 = p(odbc_result($rs, 'EvolAnnee_1_2_1_2'));
echo '<tr>
<td class="alignLeft">Janvier</td>
<td>' . number_format(odbc_result($rs, 'JanvierAN'), 0, '', ' ') . '</td>
<td>' . number_format(odbc_result($rs, 'JanvierAN1'), 0, '', ' ') . '</td>
<td>' . $cf . '%</td>
<td>' . number_format(odbc_result($rs, 'JanPrev'), 0, '', ' ') . '</td>
<td>' . $cf2 . '%</td>
</tr>';
$cf = p(odbc_result($rs, 'EvolAnnee_2_2_2'));
$cf2 = p(odbc_result($rs, 'EvolAnnee_2_2_1_2'));
echo '<tr>
<td class="aligneLeft">Février</td>
<td>' . number_format(odbc_result($rs, 'FevrierAN'), 0, '', ' ') . '</td>
<td>' . number_format(odbc_result($rs, 'FevrierAN1'), 0, '', ' ') . '</td>
<td>' . $cf . '%</td>
<td>' . number_format(odbc_result($rs, 'FevPrev'), 0, '', ' ') . '</td>
<td>' . $cf2 . '%</td>
</tr>';
?>
</tbody>
</table>
quand au reste j'ai l'impression qu'il y a un problème de conception, autant au niveau de la source de donnée que de l'utilisation dans le code ?
- tu fais 12 fois les 8 lignes du echo ?
- Les noms de champs sont pas super explicite.
si j'ai bien compris la logique de la chose il y a moyen de réduire le code, tout en le rendant un poil plus fexible.
<table>
<thead>
<tr>
<th class="alignLeft bold">Par mois</th>
<th class="alignCenter bold">Année en Cours</th>
<th class="alignCenter bold">Année  précédente</th>
<th class="alignCenter bold">% Evol</th>
<th class="alignCenter bold">Objectifs Année</th>
<th class="alignCenter bold">% An/Obj</th>
</tr>
</thead>
<tbody>
<?php
$mois = [1 => 'Janvier', 2 => 'Février', 3 => 'Mars', 4 => 'Avril', 5 => 'Mai', 6 => 'Juin', 7 => 'Juillet', 8 => 'Août', 9 => 'Septembre', 10 => 'Octobre', 11 => 'Novembre', 12 => 'Décembre'];
foreach ($mois as $index => $value) {
$cf = p(odbc_result($rs, 'EvolAnnee_' . $index . '_2_2'));
$cf2 = p(odbc_result($rs, 'EvolAnnee_' . $index . '_2_1_2'));
$fldName = str_replace(['é', 'û'], ['e', 'u'], $value);
echo '<tr>
<td class="alignLeft">' . $value . '</td>
<td>' . number_format(odbc_result($rs, $fldName . 'AN'), 0, '', ' ') . '</td>
<td>' . number_format(odbc_result($rs, $fldName . 'AN1'), 0, '', ' ') . '</td>
<td>' . $cf . '%</td>
<td>' . number_format(odbc_result($rs, substr($fldName, 0, 3) . 'Prev'), 0, '', ' ') . '</td>
<td>' . $cf2 . '%</td>
</tr>';
}
?>
</tbody>
</table>
@+
Il en faut peu pour être heureux ......