Récupération données mysql avec php

Résolu/Fermé
steph70 - 28 avril 2008 à 23:00
 steph70 - 29 avril 2008 à 08:38
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é decu , ca serait super biggrin

Merci d'avance

steph70
<?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

?>
A voir également:

2 réponses

kilian Messages postés 8731 Date d'inscription vendredi 19 septembre 2003 Statut Modérateur Dernière intervention 20 août 2016 1 527
28 avril 2008 à 23:03
Salut,

Partout tu as mis des trucs du genre:
echo $donnees['$Nom']

Je parie que tu voulais mettre:
echo $donnees['Nom']
0
Tout a fait,

c'etait bien ca. Une erreur toute bête d'un débutant en php

Merci Killian
0