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:
Colorez votre code PHP sur les forums grâce à Developpez.com<?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)) {
   $stringRef = str_replace(".", "", $stringReference);
   $stringSpaces = "";
   for($i=1; $i < strlen($stringRef); $i++) {
        $stringSpaces .= " ";
   }
   $stringLastRef = lastref($stringReference);
   $stringNextRef = nextref($stringReference);
   $stringContent .= "<tr><td class='body'>".$stringSpaces.$stringReference." ".htmlentities($stringTitre)."</td>".
                           "<td class='body' align='center'><a href='?id=".$stringId."&op=up&newref=".$stringLastRef[1]."' title='Monter'>Monter</a></td>".
                           "<td class='body' align='center'><a href='?id=".$stringId."&op=up&newref=".$stringNextRef[1]."&op=down' title='Descendre'>Descendre</a></td>".
                           "<td class='body' align='center'><a href='?id=".$stringId."&op=edit' title='Editer'>Editer</a></td>".
                           "<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 />";
?>
Je crois que je vais faire une pause, c'est peu être encore tout bête.
Merci
Partager