Bonsoir,
J'ai un gros souci avec cet chaine SQL :
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 SELECT ref_agrement, pharmacien.id, pharmacien.nom, pharmacien.prenom, officine.adresse, officine.pays, officine.ref_code_postal, SUBSTR(date_debut, 1, 4) FROM pharmacien LEFT JOIN agrement ON pharmacien.ref_agrement = agrement.id LEFT JOIN officine ON pharmacien.ref_identification = officine.ref_identification WHERE officine.pays = 1 AND officine.ref_code_postal BETWEEN 1 AND 504 ORDER BY pharmacien.nom
J'obtiens cette erreur :
Le plus dingue, c'est que quand je copie la chaine sql dans phpmyadmin, elle fonctionne parfaitement.Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY pharmacien.nom' at line 1' in /home/web998/public_html/filtre.php:98 Stack trace: #0 /home/web998/public_html/filtre.php(98): PDOStatement->execute(Array) #1 {main} thrown in /home/web998/public_html/filtre.php on line 98
Le code PHP est assez compliqué (création de requêtes dynamiques), je mets donc le code SQL pour le moment.
Voyez-vous une erreur dans cette chaine ?
Merci d'avance.
bee
Partager