Meilleurs Vœux pour cette nouvelle année !
J'ai une base de données, ou pour faire simple, je veux afficher une information par ligne et par colonne :
la base de données ressemble à ceux-ci :
id
nom
info_a
info_b
date
Cela fonctionne, mais c'est moi qui code l'affichage tant par ligne et tant par colonne

Code : Tout sélectionner
$lecture = $connexion->query("SELECT * FROM articles");
$data = $lecture->fetch();
echo '<table width="1000" border="0">
<tr>
<td width="150" colspan="1"><center>'.$data['nom_1'].'</center></td>
<td width="150" colspan="1">'.$data['info_a1'].'</td>
<td width="150" colspan="1">'.$data['info_b1'].'</td>
<td width="150" colspan="1">'.$data['date1'].'</td>
</tr>
<tr>
<td width="150" colspan="1"><center>'.$data['nom_2'].'</center></td>
<td width="150" colspan="1">'.$data['info_a2'].'</td>
<td width="150" colspan="1">'.$data['info_b2'].'</td>
<td width="150" colspan="1">'.$data['date2'].'</td>
</tr>
<tr>
<td width="150" colspan="1"><center>'.$data['nom_3'].'</center></td>
<td width="150" colspan="1">'.$data['info_a3'].'</td>
<td width="150" colspan="1">'.$data['info_32'].'</td>
<td width="150" colspan="1">'.$data['date3'].'</td>
</tr>
<tr>
<td width="150" colspan="1"><center>'.$data['nom_x'].'</center></td>
<td width="150" colspan="1">'.$data['info_x2'].'</td>
<td width="150" colspan="1">'.$data['info_x2'].'</td>
<td width="150" colspan="1">'.$data['datex'].'</td>
</tr>
</table>'
$lecture->closeCursor();
id | nom | info_a | info_b | date
1 | nom1 | info_a1 | info_b1 | date1
2 | nom2 | info_a2 | info_b2 |date2
3 | nom3 | info_a3 | info_b3 |date3
4 | nom4 | info_a4 | info_b4 |date4
xx| xxxxx| xxxx | xxxx |xxxxx
xx| xxxxx| xxxx | xxxx |xxxxx
xx| xxxxx| xxxx | xxxx |xxxxx
Je voudrais donc définir un nombre de ligne et de colonne pour afficher le contenu si dessus, comme ci :
nom1 nom2 nom3 nom4
info_a1 info_a2 info_a3 info_a4
info_b2 info_b2 info_b3 info_b4
date1 date2 date3 date4
nom5 nom6 nom7 nom8
info_a5 info_a6 info_a7 info_a8
info_b5 info_b6 info_b7 info_b8
date5 date6 date7 date8
nom x nom x nom x nom x
info_ax info_ax info_ax info_ax
info_bx info_bx info_bx info_bx
datex datex datex datex
et ainsi de suite
Comment puis je faire, pour donc afficher sur plusieurs ligne par 4 colonnes (en variable au cas ou je veuille en mettre 3, 4 ou 5.
Merci beaucoup pour votre aide,
Bien cordialement,
Christophe