Zen cart order search function, which uses Chinese keywords to search, displays Illegal mix of collations for o

Source: Internet
Author: User
Tags zen cart

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.