Zen cart version 1.3.9
Log on to the zen cart background, choose "customer management"> "Order Management", and use the order search function. The keyword is Chinese: Li Chao. the following error occurs during the search:
1271 Illegal mix of collations for operation 'like'
In:
[Select count (*) as total from (zc_orders_status s, zc_orders o) left join zc_orders_total ot on (o. orders_id = ot. orders_id and ot. class = 'ot _ total') where (o. orders_status = s. orders_status_id and s. required age_id = '2') and (o. customers_city like '% Li Chao %' or o. customers_postcode like '% Li Chao %' or o. date_purchased like '% Li Chao %' or o. billing_name like '% Li Chao %' or o. billing_company like '% Li Chao %' or o. billing_street_address like '% Li Chao %' or o. delivery_city like '% Li Chao %' or o. delivery_postcode like '% Li Chao %' or o. delivery_name like '% Li Chao %' or o. delivery_company like '% Li Chao %' or o. delivery_street_address like '% Li Chao %' or o. billing_city like '% Li Chao %' or o. billing_postcode like '% Li Chao %' or o. customers_email_address like '% Li Chao %' or o. customers_name like '% Li Chao %' or o. customers_company like '% Li Chao %' or o. customers_street_address like '% Li Chao %' or o. customers_telephone like '% Li Chao %' or o. ip_address like '% Li Chao %')]
This problem was analyzed from the SQL statement. It was found that o. date_purchased like '% Li Chao %' caused an error in the execution of the entire SQL statement.
In MySQL 5.5 or above, if the field Type is time, date, datetime
If you use like '% Chinese %' during select, Illegal mix of collations for operation 'like' is displayed'
When writing a program, you need to search for each field. During execution, the syntax like '% Chinese %' may appear,
This will not cause errors in MySQL for a long time. However, to upgrade to MySQL 5.5 or later, you must change it to like binary '% Chinese %' to avoid errors.