Mysql cannot search data. hurry up and ask for help online

Source: Internet
Author: User
Mysql cannot search data. in a hurry, the online distress website uses UTF-8 to store data. Read data and write data using:
Mysql_query ("set names 'utf-8 '")

When searching database tables, most of them cannot be searched as long as they are Chinese.

$ Add = $ SQL-> mdenin_select ("SELECT * FROM movie WHERE 'a0 'LIKE' % $ so % 'LIMIT 0, 1000 ");





Reply to discussion (solution)

Are you using phpmyadmin? Are Chinese characters garbled?

Comment out mysql_query ("set names 'utf-8 '")
Try again

In addition, the UTF-8 character set of mysql should be utf8
Therefore, you only access the data by using the default mysql character set latin1.

Are you using phpmyadmin? Are Chinese characters garbled?

Comment out mysql_query ("set names 'utf-8 '")
Try again
This is the data saved by UTF-8, but the data cannot be searched during the search. comment out mysql_query ("set names 'utf-8'") or cannot be searched.

In addition, the UTF-8 character set of mysql should be utf8
Therefore, you only access the data by using the default mysql character set latin1.
Then how to convert the data into utf8

Read the content of the garbled field to the variable $ s
Echo base64_encode ($ s );
Post result

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.