Bonjour,
Nous essayons de coder sur un serveur local, un site ou nous présenterons un magasin de jeux vidéo (fictif) mais nous avons un problème concernant la liste des jeux, voici l'erreur que WAMP m'affiche sur le site web:
Et voici le codage complet de mon fichier:Warning: mysql_fetch_object(): supplied resource is not a valid MySQL result resource in C:\wamp\www\Jeux video\liste.jeux.php on line 36
Code PHP : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 <html> <head> <link rel="stylesheet" media="screen" type="text/css" title="stylecss" href="Style.css" /> <meta http-equiv="Content-Type" content="text/html"; charset="ascii" /> <title>Liste des jeux</title> </head> <?php //inclusion du fichier de connexion require_once ("connexion.php"); //connexion au serveur et selection de la base $con=connecter(); //ecriture de la requete de selection $requete="SELECT * FROM jeux video ORDER BY Titre"; //execution de la requete et recuperaton du pointeur sur le jeu d'enregistrements $jeu=mysql_query($requete,$con); //parcours du jeu d'enregistrements ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xthml11"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <title>Liste des jeux video</title> </head> <body> <table border="2" cellpadding="5" cellspacing="0"> <tr> <!--en tête--> <th>Titre</th> <th>Date de sortie</th> <th>Genre</th> <th>Support</th> <th>Prix</th> </tr> <?php while ($enregistrement=mysql_fetch_object($con)){ //recuperation du champ "Titre" $Titre=$enregistrement=$Titre; //recuperation du champ "Date de sortie" $Date_de_sortie=$enregistrement->Date_de_sortie; //recuperation du champ "Genre" $Genre=$enregistrement->Genre; //recuperation du champ "Support" $Support=$enregistrement->Support; //recuperation du champ "Prix" $Prix=$enregistrement->Prix; } ?> <tr> <!--affichage des champs--> <td><?php echo $Titre ?></td>; <td><?php echo $Date_de_sortie ?></td>; <td><?php echo $Genre ?></td>; <td><?php echo $Support ?></td>; <td><?php echo $Prix ?></td>; </tr> </table> </body> </html>
L'erreur est censée se trouver ici: "while ($enregistrement=mysql_fetch_object($con)){" mais je ne voit aucun problème
J'ai également à côté et pour ce même fichier, ces erreurs:
Pourriez-vous me venir en aide, s'il vous plait?Notice: Undefined variable: Titre in C:\wamp\www\Jeux video\liste.jeux.php on line 51
Notice: Undefined variable: Date_de_sortie in C:\wamp\www\Jeux video\liste.jeux.php on line 52
Notice: Undefined variable: Genre in C:\wamp\www\Jeux video\liste.jeux.php on line 53
Notice: Undefined variable: Support in C:\wamp\www\Jeux video\liste.jeux.php on line 54
Notice: Undefined variable: Prix in C:\wamp\www\Jeux video\liste.jeux.php on line 55
Merci beaucoup
EDIT: première erreur corrigée il fallait remplacer mysql_fetch_object par mysql_query il me reste par contre les erreurs de la ligne 51 à 55
Partager