Faire un while qui affiche un tableau [Résolu]

Signaler
Messages postés
5
Date d'inscription
jeudi 11 septembre 2003
Statut
Membre
Dernière intervention
10 juillet 2009
-
Messages postés
340
Date d'inscription
dimanche 18 septembre 2005
Statut
Membre
Dernière intervention
22 octobre 2009
-
Bonjour,
Ci dessous je vous met ma page ou se trouve mes while
Mon souci avec cette méthode j'ai un affichage de tableau sans ligne.
Ma question que dois je faire pour afficher un résultat dans une seule case?
Merci
CODE:
<?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['datesaisie'];
  echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['numcmd'];
  echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['transporteur'];
  echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['fournisseur'];
  echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['pal'];
echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['dateenl'];
echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['dateliv'];
echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['appro'];
  echo "
";
}
 ?>
       
</td>
        <td width="80" height="24">

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['saisiepar'];
  echo "
";
}
 ?>
       
</td>
        <td>

          <?php
    $query = "SELECT * FROM infos ORDER BY 'numcmd'";
$result = mysql_query($query, $link) or die($query . " - " . mysql_error());

    while ($tab = mysql_fetch_array($result)) {
  echo $tab['etatcmd'] ;
  echo "
";
}
 ?>
       
</td>
      </tr>
    </table>

1 réponse

Messages postés
340
Date d'inscription
dimanche 18 septembre 2005
Statut
Membre
Dernière intervention
22 octobre 2009

Bonjour,

Essayes ceci :

<?php
    $query=\"SELECT * FROM infos ORDER BY 'numcmd'\";
    $result=mysql_query($query, $link) or die($query . \" - \" . mysql_error());
    $cellstart='';
    $cellend=', ';
    while ($tab=mysql_fetch_array($result)) {
        echo '----
';
        echo $cellstart; echo $tab['datesaisie']; echo $cellend;
        echo $cellstart; echo $tab['numcmd']; echo $cellend;
        echo $cellstart; echo $tab['transporteur']; echo $cellend;
        echo $cellstart; echo $tab['fournisseur']; echo $cellend;
        echo $cellstart; echo $tab['pal']; echo $cellend;
        echo $cellstart; echo $tab['dateenl']; echo $cellend;
        echo $cellstart; echo $tab['dateliv']; echo $cellend;
        echo $cellstart; echo $tab['appro']; echo $cellend;
        echo $cellstart; echo $tab['saisiepar']; echo $cellend;
        echo $cellstart; echo $tab['etatcmd']; echo $cellend;
        echo $cellstart; echo $tab['datesaisie']; echo $cellend;
        echo '';
    }
?>

Cordialement

nb : code non testé.