多くの同様のスレッドを読んだ後、ここに投稿していますが、それでも問題は解決しません。そのため、このクエリの何が問題になっているのかを特定するためにMySQLの専門家が必要です。
クエリは次のようになります。
SELECT DISTINCT(p.ID), p.*, pm.*, t.*, tt.*, tr.*
FROM wp_posts p, wp_postmeta pm, wp_terms as t, wp_term_taxonomy as tt, wp_term_relationships as tr
'WHERE p.ID = pm.post_id
AND t.term_id = tt.term_id
AND tt.taxonomy = wpsc_product_category
AND tt.term_taxonomy_id = tr.term_taxonomy_id
AND tr.object_id = p.ID
AND p.post_type = wpsc-product
AND pm.meta_key != _wpsc_price
AND (p.post_title LIKE '%'\"some string to search\"'%'
OR p.post_content LIKE '%'\"some string to search\"'%'
OR pm.meta_value = '\"some string to search\"'
OR t.name LIKE '%'\"some string to search\"'%')
GROUP BY p.ID ORDER By p.ID '
次のエラーが発生するクエリ形式の何が問題になっているのかはわかりません。
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 ''WHERE p.ID = pm.post_id AND t.term_id = tt.term_id AND tt.taxonomy = wpsc_produ' at line 1
私のクエリでは、文字列を統合する必要がありますが、PDOに変更するには遅すぎます。どうすればそのエラーを修正できますか?
PS:私はローカルサーバーで実行しているので、php infoはMySQLサーバーに関するこの情報を表示します、私はそれがバージョンだと思います:
Client API version 5.5.29