Salut,
Voici ton code
Code :
- // On commence un tableau
- $affichecontenu.='<table border="1">';
- // Les têtes de colonne
- $affichecontenu.='<tr><th>fabriquant</th><th>ref</th><th>id</th><th>prix</th></tr>';
- // On définit la taille du tableau maintenant, ça évite de la recalculer a chaque passage dans la boucle
- $count_main2=count($main2);
- // La boucle elle même
- for($i=0;$i<$count_main2;$i++)
- {
- $affichecontenu.='<tr><td><strong>'.$main2[$i]['fabriquant'].'</strong></td>';
- $affichecontenu.='<td>'.$main2[$i]['produit_id'].'</td>';
- $affichecontenu.='<td><a href="?section='.$section.'&produit='.$main2[$i]['produit_id'].'">'.$main2[$i]['ref'].'</a></td>';
- $affichecontenu.='<td>'.$main2[$i]['prix'].'</td></tr>';
- }
- // On finit le tableau
- $affichecontenu.='</table>';
- // On affiche le tout
- echo $affichecontenu;
|
Juste que le code html retourné est immonde, a toi de t'en occuper en ajoutant des \n, et en remplaçant le ' border="1" ' par une class CSS
Code :
- <table border="1"><tr><th>fabriquant</th><th>ref</th><th>id</th><th>prix</th></tr><tr><td><strong>Stanton</strong></td><td>1</td><td><a href="?section=&produit=1">T120.C</a></td><td>959</td></tr><tr><td><strong>Stanton</strong></td><td>2</td><td><a href="?section=&produit=2">STR8-150</a></td><td>1189</td></tr></table>
|
Sinon, évite les .' '; , ça ne sert a rien.
Et pense a rendre ton code valide xhtml, en commençant par mettre <br /> au lieu de <br>.
A plus 
Message édité par freacky22527 le 02-01-2006 à 17:34:16