Salut,

J'ai une requête qui liste les lignes de ma table. Je les récupère toutes et pour chaque ligne créé une ligne de tableau.
Mais peu importe le nombre de résultats, j'ai une ligne dans mon tableau.
Voila mon code:

<?php
$stringContent
.= "<table align='center' width='70%' cellspacing='0' cellpadding='5'>";
$db->query("SELECT titre, reference, id FROM manual_content ORDER BY reference");
while (list(
$stringTitre, $stringReference, $stringId) = mysql_fetch_array($db->query)) {
&#160;&#160;&#160;
$stringRef = str_replace(".", "", $stringReference);
&#160;&#160;&#160;
$stringSpaces = "";
&#160;&#160;&#160;for(
$i=1; $i < strlen($stringRef); $i++) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
$stringSpaces .= "&nbsp;&nbsp;&nbsp;";
&#160;&#160;&#160;}
&#160;&#160;&#160;
$stringLastRef = lastref($stringReference);
&#160;&#160;&#160;
$stringNextRef = nextref($stringReference);
&#160;&#160;&#160;
$stringContent .= "<tr><td class='body'>".$stringSpaces.$stringReference." ".htmlentities($stringTitre)."</td>".
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
"<td class='body' align='center'><a href='?id=".$stringId."&op=up&newref=".$stringLastRef&#91;1]."' title='Monter'>Monter</a></td>".
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
"<td class='body' align='center'><a href='?id=".$stringId."&op=up&newref=".$stringNextRef&#91;1]."&op=down' title='Descendre'>Descendre</a></td>".
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
"<td class='body' align='center'><a href='?id=".$stringId."&op=edit' title='Editer'>Editer</a></td>".
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
"<td class='body' align='center' style='border-right:1px solid gray'><a OnClick='return delete_articles()' href='?id=".$stringId."&op=delete' title='Supprimer'>Supprimer</a></td></tr>";
}
$stringContent .= "</table><br />";
?>
Colorez votre code PHP sur les forums grâce à Developpez.com

Je crois que je vais faire une pause, c'est peu être encore tout bête.
Merci