Php+mysql solving emoji problems

Source: Internet
Author: User

Php+mysql solving emoji problems

Problem Description:
When I write a project today, some customer reviews use the emoji emoji??, results log shows SQL errors:
SQL Error:

INSERT into' xXx`.' xXx` (' Customer_id`, ' Worker_id`, ' COntent`, ' sTatus`, ' sCore`, ' Order_id`, ' uPdate_time`, ' CReate_user`, ' CReate_time`)VALUES (100001,10001, ' feedback from the elderly is particularly good,2Hours of service has not been idle, the elderly want to Zhou Chen service next time, to you praise??1,5,1133,1436327015,50000246,1436327015)

Online query data resolution steps:
1. Upgrade MySQL to 5.5 or above (to support emoji)
2. Change the database, the data table character is encoded as UTF8MB4
And the same error is reported.
Check your home code discovery:

mysqli_set_charset($handle"utf8")

Switch

mysqli_set_charset($handle"utf8mb4")

Success ~ Happy .

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Php+mysql solving emoji problems

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.