Php-mysql query for non-decoded Unicode characters, fuzzy query unsuccessful

Source: Internet
Author: User
Keywords PHP SQL Fuzzy Query
Tags mysql query
Phpsql Fuzzy Query

I am in the database Student basic information, the Student Name field is a JSON wrapped string, such as {"Stu_name": "\u5f20\u4e09"}, indicating that the student name is Zhang San. I am in the PHP program to do the student name fuzzy query, when I enter "Zhang", the background program with Json_encode to get the Unicode encoding \u5f20, and then the database fuzzy query condition is like '%\u5f20% ', this time, can return Zhang San that data, But when I input "Zhang San" two words, like '%\u5f20\u4e09% ', unexpectedly can not return. Then I tried several times, found that two percent of the middle as long as it is a Chinese character can be traced, more than one can not. In addition, a%,like '%\u5f20%\u4e09% ' is inserted between Chinese characters so that it can be queried. I use Var_dump (' \u5f20\u4e09 ') output display is 12 characters, Chinese characters should have no other characters, how is it? Ask for expert guidance.

  • 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.