我在這裏張貼手動閱讀很多類似的線程之後,但不解決我的問題,所以我需要MySQL的高手幫我找出什麼地方錯了這個查詢:格式化MySQL查詢:您的SQL語法中有錯誤;檢查對應於你的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。我怎樣才能解決這個錯誤?提前Thanx。
PS:我是本地服務器上運行,因此PHP的信息顯示我關於MySQL服務器的信息,我想它的版本:
Client API version 5.5.29