Alimentation d'un tableau HTML a partir d'une BDD
Salam ; j'ai la requête suivante:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
........
$afflist=$cbd->prepare('SELECT * FROM conteneur
INNER JOIN com
ON conteneur.cdc=com.cdc
INNER JOIN etab
ON conteneur.cdet=etab.cdet') or die('erreur de requête');
/* $afflist->bindParam(':an', PDO::PARAM_INT); */
try {
// On exécute la requête
$afflist->execute();
// On récupère en 1er toutes les données
$datalist = $afflist->fetchAll(PDO::FETCH_ASSOC);
// libéré la connexion du serveur
$afflist->closeCursor();
//print_r ($datacom); //verrification du résultat
}
catch( Exception $e ){
echo 'Erreur d\'affichage : ', $e->getMessage();
} |
le print affiche bien les résultat.
l’affichage des données:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
..........
<tbody>
<tr>
<?php
foreach ($datalist as $list){
echo'<th rowspan="2">'.$list['datedec'].'</th>';
echo'<th rowspan="2">'.$list['etab'].'</th>';
echo'<th rowspan="2">'.$list['com'].'</th>';
echo'<th rowspan="2">'.$list['m'].'</th>';
echo'<th rowspan="2">'.$list['f'].'</th>';
echo'<th rowspan="2">Modifier</th><th rowspan="2">Supprimer</th>';
}
?>
</tbody> |
mon problème au lieu d'avoir une ligne au dessous de l'autre , j'ai une ligne après l’autre !!!!!!:aie: