Problème PHP et requête SQL
Résolu
Magyc41
Messages postés
56
Date d'inscription
Statut
Membre
Dernière intervention
-
Magyc41 Messages postés 56 Date d'inscription Statut Membre Dernière intervention -
Magyc41 Messages postés 56 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je suis débutant et je tâtonne! Je précise pour commencer ^^!
Je travaille sous wamp et j'ai réussi a connecter ma page a ma BDD.
Mon problème c'est quand j'essaye d'implanter une requête SQL dans ma page. J'ai des erreurs lors de son exécution et de l'affichage de son résultat.
Voilà mon code.
Les erreurs :
Client :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 66
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Adresse de Livraison :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 67
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Fournisseur :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 68
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Prix :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 69
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Date_de_Livraison:
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 70
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Date_de_la_commande :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 71
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Je suis débutant et je tâtonne! Je précise pour commencer ^^!
Je travaille sous wamp et j'ai réussi a connecter ma page a ma BDD.
Mon problème c'est quand j'essaye d'implanter une requête SQL dans ma page. J'ai des erreurs lors de son exécution et de l'affichage de son résultat.
Voilà mon code.
<?php // Question 1 $resultat=$connexion->query("SELECT client.CLI_NOM as client, CLI_ADD, DATE_LIV, DATE_COM, FOUR_NOM, (PRIX*QTE_VENTE) as PRIX FROM client join commande on 'client.CLI_NOM' = 'commande.CLI_NOM' join ligne_commande on 'commande.ID_LIGNE_CMD' = 'ligne_commande.ID_LIGNE_CMD' JOIN stock on 'ligne_commande.ID_STOCK' = 'stock.ID_STOCK' Where ID_CLIENT = '1' "); $lignes=$resultat->fetch(PDO::FETCH_OBJ); echo "Client : "; echo $lignes->client.'<br />'; echo "Adresse de Livraison : "; echo $lignes->CLI_ADD. '<br />'; echo "Fournisseur : "; echo $lignes->DATE_LIV. '<br />'; echo "Prix : "; echo $lignes->DATE_COM. '<br />'; echo "Date_de_Livraison: "; echo $lignes->FOUR_NOM. '<br />'; echo "Date_de_la_commande : "; echo $lignes->PRIX. '<br />'; ?>
Les erreurs :
Client :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 66
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Adresse de Livraison :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 67
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Fournisseur :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 68
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Prix :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 69
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Date_de_Livraison:
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 70
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
Date_de_la_commande :
( ! ) Notice: Trying to get property of non-object in D:\Magyc\programme\wamp\www\Projet\index.php on line 71
Call Stack
# Time Memory Function Location
1 0.0004 682912 {main}( ) ..\index.php:0
A voir également:
- Problème PHP et requête SQL
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Logiciel sql - Télécharger - Bases de données
- Jointure sql ✓ - Forum MySQL
- Alert php ✓ - Forum PHP
2 réponses
SELECT client.CLI_NOM as client, CLI_ADD, DATE_LIV, DATE_COM, FOUR_NOM, (PRIX*QTE_VENTE) as PRIX
FROM client
JOIN commande on `client`.`CLI_NOM` = `commande`.`CLI_NOM`
JOIN ligne_commande on `commande`.`ID_LIGNE_CMD` = `ligne_commande`.`ID_LIGNE_CMD`
JOIN stock on `ligne_commande`.`ID_STOCK` = `stock`.`ID_STOCK`
Where ID_CLIENT = '1'
Bonjour ton erreur est au niveau de tes jointures
`commande.CLI_NOM` , tu met entre quotes l'ensemble table.champ , c'est faux
soit tu ne met aucune quote soit tu les met sur la table ET le champ comme ceci :
`commande`.`CLI_NOM`
ps : la quote en question est Alt Gr + 7
FROM client
JOIN commande on `client`.`CLI_NOM` = `commande`.`CLI_NOM`
JOIN ligne_commande on `commande`.`ID_LIGNE_CMD` = `ligne_commande`.`ID_LIGNE_CMD`
JOIN stock on `ligne_commande`.`ID_STOCK` = `stock`.`ID_STOCK`
Where ID_CLIENT = '1'
Bonjour ton erreur est au niveau de tes jointures
`commande.CLI_NOM` , tu met entre quotes l'ensemble table.champ , c'est faux
soit tu ne met aucune quote soit tu les met sur la table ET le champ comme ceci :
`commande`.`CLI_NOM`
ps : la quote en question est Alt Gr + 7