Echec Requete en PHP - OK sous PhpMyAdmin
Bonjour sous PHP / MYSQL 5.0.45 j'obtiens l'erreur suivante:
« Execution of a query to the database failed - You have an error in your SQL syntax;
Citation:
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id, GROUP_CONCAT ( DISTINCT ' at line 1 »
Ce que je ne comprends pas c'est que la même requete fonctionne sous PhpMyAdmin lorsque je teste le même ordre sql.
Voici la requete:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| SELECT sc.id, sc.pagetitle, sc.longtitle, sc.description, sc.alias, sc.introtext, sc.menutitle, sc.content, sc.publishedon,
GROUP_CONCAT ( DISTINCT CAST(ntv.id AS CHAR) SEPARATOR "," ) AS tv_id,
GROUP_CONCAT ( DISTINCT ntv.value SEPARATOR ", " )
AS tv_value
FROM `base1`.`mdx_site_content` sc
LEFT JOIN (
SELECT DISTINCT tv.id, tv.value, tv.contentid FROM `base1`.`mdx_site_tmplvar_contentvalues` tv
WHERE ( ((tv.value LIKE '%school%')) ) )
AS ntv ON sc.id = ntv.contentid
WHERE ( sc.id IN (63,64,65,66,67,68,69,70,71,72,73,97) AND sc.published=1 AND sc.searchable=1 AND sc.deleted=0 AND sc.type='document'
AND sc.privateweb=0 )
GROUP BY sc.id
HAVING ( ( (sc.pagetitle LIKE '%school%') OR (sc.longtitle LIKE '%school%') OR (sc.description LIKE '%school%')
OR (sc.alias LIKE '%school%') OR (sc.introtext LIKE '%school%') OR (sc.menutitle LIKE '%school%')
OR (sc.content LIKE '%school%') OR (tv_value LIKE '%school%') ) )
ORDER BY sc.publishedon,sc.pagetitle |
Merci pour votre aide.