[英]Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'
[英]Illegal mix of collations for operation 'like' with PDO bindValue()
我將代碼從mysql_query更改為pdo prepare(),bindValue()和execute()
但是使用新代碼,當我將希伯來語值綁定到:t0進行查詢時
select * from product where ( prd_name_HEB like :t0 or prd_code like :t0 )
我懂了
General error: 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (hebrew_general_ci,COERCIBLE) for operation 'like'
我現在無法將整個數據庫更改為utf8_unicode_ci。
我了解可以在查詢中使用COLLATE設置排序規則,但不知道將其添加到何處。
請讓我知道什么是正確的語法,以下查詢使用“ like”和“ COLLATE”:
從產品中選擇*(prd_name_HEB如:t0或prd_code如:t0)
有沒有一種方法可以向PDO bindValue()添加排序規則?
謝謝。
解決了:
if searchString.containsHebrewCharacters()
select * from product where ( prd_name_HEB like :t0 )
else
select * from product where ( prd_name_HEB like :t0 or prd_code like :t0 )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.