Tableu dynamique horizintal

Bonjour,
salut je cherche comment cree une table dynamique horizintal pour aficher mes tout mes produit horzontalement
comme : http://www.microchoix.ma/categorie.asp?idp=28&idu=1

et merci c ugrnt svp

en php (dreamweaver )

5 réponses

  1. Contributeur
    Ah ok donc tu veux que les produits soient les uns à côté des autres et non pas les uns sous les autres!

    Et bien il faut que tu fasses une requête pour chaque ligne alors ...

    <?php
    echo '<table>';
    echo '<tr>';
    $result = mysql_query("SELECT id FROM produits");
    while ($data = mysql_fetch_array($result) ) {
    echo '<td>' . $data['id'] . '</td>';
    }
    echo '</tr>';
    echo '<tr>';
    $result = mysql_query("SELECT nom FROM produits");
    while ($data = mysql_fetch_array($result) ) {
    echo '<td>' . $data['nom'] . '</td>';
    }
    echo '</tr>';
    echo '<tr>';
    $result = mysql_query("SELECT image FROM produits");
    while ($data = mysql_fetch_array($result) ) {
    echo '<td>' . $data['image'] . '</td>';
    }
    echo '</tr>';
    echo '</table>';
    ?>

    C'est quelque chose comme ça que tu veux?
    1. mais non regarde mon frer
      moi j veu affichier mes produit comme ca

      1 2 3 4
      image 1 image2 image3 image 4
      nom 1 nnom2 nom3 nom4
      der 1 der2 der 3 der3

      tu puge et merci
      1. Contributeur
        Bah il suffit d'augmenter la longueur des cases et de réduire leur hauteur
        1. voila mon code mais c me donne une table vertival

          <table width="560" border="0">
          <tr>
          <td width="110">Nom</td>
          <td width="137">Image</td>
          <td width="299">Description</td>
          </tr>
          <?php do { ?>
          <tr>
          <td><?php echo $row_fr_b['nom']; ?></td>
          <td><img src="images/<?php echo $row_fr_b['image']; ?>" width="123" height="140"></td>
          <td valign="top"><?php echo $row_fr_b['description']; ?></td>
          </tr>
          <?php } while ($row_fr_b = mysql_fetch_assoc($fr_b)); ?>
          </table>

          ce que je veut moi u table hori et merci
          1. Contributeur
            Tu fais une boucle en php avec while() pour parcourir tous tes produits :
            Voici un bout de code exemple non testé :
            <?php
            echo '<table>';
            while ($data = mysql_fetch_array($result) ) {
            echo '<tr>';
            echo '<td>' . $data['libelle'] . '</td>';
            echo '<td>' . $data['caracteristiques'] . '</td>';
            echo '<td>' . $data['photo'] . '</td>';
            echo '</tr>';
            }
            echo '</table>';
            ?>