Tableau HTMl...:s

j'aimerais que toutes les colone de mon tableau soit de la meme taille...
la les collonne sont toutes decalé...:s

//--on crée la requête SQL------------------- 
$sql = 'SELECT * FROM machine ORDER BY NomnetBIOS'; 


//--on envoie la requête--------------------- 
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 


//--on fait une boucle qui va faire un tour pour chaque enregistrement--------------- 

while($data = mysql_fetch_assoc($req)) 
    {  
?>
<TABLE border=1 cellpadding="2" bgcolor="#F5DEB3">


	<th><?php echo $data['NomnetBIOS']; ?></th>
	<th><?php echo $data['OS']; ?></th>
	<th><?php echo $data['Licence OS']; ?></th>
	<th><?php echo $data['Office']; ?></th>
	<th><?php echo $data['Licence Office']; ?></th>
	<th><?php echo $data['Etat']; ?></th>
	<th><?php echo $data['Date_achat']; ?></th>
	<th><?php echo $data['Processeur']; ?></th>
	<th><?php echo $data['Nomservice']; ?></th>
	<th><?php echo $data['Nompersonnel']; ?></th>

</TABLE>
<?php
    } 


//--on ferme la connexion à mysql----------------------- 
mysql_close(); 

?> 
Configuration: Windows XP
Internet Explorer 7.0

7 réponses

  1. un tableau c'est
    <table>
    <tr>
    <td ou th>
    </td ou /th>
    </tr>
    .....
    </table>

    or je ne vois ni de <tr> ni de <td>

    et puis je suis pas sur que je code php soit bon
    1. ca revien au meme si je fait ca...

      //--on envoie la requête---------------------
      $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());

      //--on fait une boucle qui va faire un tour pour chaque enregistrement---------------

      while($data = mysql_fetch_assoc($req))
      {
      ?>
      <TABLE border=1 cellpadding="2" bgcolor="#F5DEB3">

      <tr>
      <td><?php echo $data['NomnetBIOS']; ?></td>
      <td><?php echo $data['OS']; ?></td>
      <td><?php echo $data['Licence OS']; ?></td>
      <td><?php echo $data['Office']; ?></td>
      <td><?php echo $data['Licence Office']; ?></td>
      <td><?php echo $data['Etat']; ?></td>
      <td><?php echo $data['Date_achat']; ?></td>
      <td><?php echo $data['Processeur']; ?></td>
      <td><?php echo $data['Nomservice']; ?></td>
      <td><?php echo $data['Nompersonnel']; ?></td>
      </tr>
      </TABLE>
      <?php
      }

      //--on ferme la connexion à mysql-----------------------
      mysql_close();

      ?>
      1. en gros c'est ca
        <tr></tr>// représente une ligne
        <th></th>//h=head donc tete du tableau
        <td></td>//cellule par ligne 2<tr><td></td><td></td></tr>donnera deux cellules dans la ligne
        

        n oublie pas aussi qu il existe beaucoup d attribut pour un tableau mais j espere que ca t aura aidé
        1. oui ca c'est bon! si en plus tu veux fixer la tailler de tes collones, il faut mettre <td width='20%'> .... </td> par exemple, et chaque cellule aura la meme largeur
          1. je viens de l'ecrire juste au dessus <td width='20%'> .....</td>

            ou bien <td width='50px'>.... </td>