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