Bonjour a tous,
J'ai une base de données qui contient différentes informations que je veux afficher dans un tableau.
Lorsque je l'affiche hors tableau, pas de souci ca marche mais dans le cas du tableau, j'ai bien les intitulés mais je ne récupère pas les données.
J'ai dû faire une petite erreur mais je n'arrive pas à mettre le doigt dessus.
Si vous pouvez jeter un oeil et me dire si mon script est correct et surtout ou je me suis lamentablement trompé
, ca serait super
Merci d'avance
Lonewolf
Modifié par lonewolf (29 Apr 2008 - 18:21)
J'ai une base de données qui contient différentes informations que je veux afficher dans un tableau.
Lorsque je l'affiche hors tableau, pas de souci ca marche mais dans le cas du tableau, j'ai bien les intitulés mais je ne récupère pas les données.
J'ai dû faire une petite erreur mais je n'arrive pas à mettre le doigt dessus.
Si vous pouvez jeter un oeil et me dire si mon script est correct et surtout ou je me suis lamentablement trompé


Merci d'avance
Lonewolf
<?php
mysql_connect("localhost", "login", "mdp"); // Connexion à MySQL
mysql_select_db("base"); // Sélection de la base
$reponse = mysql_query("SELECT * FROM covoiturage"); // Requête SQL
// On fait une boucle pour lister tout ce que contient la table :
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<table width="981" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="62"><div align="center">Prenom</div></td>
<td width="62"><div align="center">Nom</div></td>
<td width="71"><div align="center">Adresse</div></td>
<td width="73"><div align="center">Téléphone</div></td>
<td width="80"><div align="center">Destination</div></td>
<td width="86"><div align="center">Hr de depart</div></td>
<td width="89"><div align="center">Hr de retour</div></td>
<td width="59"><div align="center">Lundi</div></td>
<td width="63"><div align="center">Mardi</div></td>
<td width="77"><div align="center">Mercredi</div></td>
<td width="56"><div align="center">Jeudi</div></td>
<td width="72"><div align="center">Vendredi</div></td>
<td width="57"><div align="center">Samedi</div></td>
<td width="74"><div align="center">Dimanche</div></td>
</tr>
<tr>
<td><?php echo $donnees['$Nom']; ?></td>
<td><?php echo $donnees['$Prenom']; ?></td>
<td><?php echo $donnees['$Adresse']; ?></td>
<td><?php echo $donnees['$Telephone']; ?></td>
<td><?php echo $donnees['$Destination']; ?></td>
<td><?php echo $donnees['$HeureDepart']; ?></td>
<td><?php echo $donnees['$HeureRetour']; ?></td>
<td><?php echo $donnees['$Lundi']; ?></td>
<td><?php echo $donnees['$Mardi']; ?></td>
<td><?php echo $donnees['$Mercredi']; ?></td>
<td><?php echo $donnees['$Jeudi']; ?></td>
<td><?php echo $donnees['$Vendredi']; ?></td>
<td><?php echo $donnees['$Samedi']; ?></td>
<td><?php echo $donnees['$Dimanche']; ?></td>
</tr>
</table>
<hr style="width: 100%; height: 2px;">
<?php
}
mysql_close(); // Déconnexion de MySQL
?>
Modifié par lonewolf (29 Apr 2008 - 18:21)