The cookie is encoded using the big5 set, and it cannot insert into MySQL. Could you help me to solve this problem?
Fields: username is eng, date1 is date, reason1 is a Chinese character.
$reason1 = $_COOKIE["reason"];
$sql2="INSERT INTO
attendance_count(username,date,count_time,appendix)
VALUES ('$username','$date1','0','$reason1')";
mysql_query($sql2);
Use UTF-8 when you create table.
Use UTF-8 when you insert to table
Read More
And More
Detailed Code
Below code is tested code please do the following its works.
If you have already created database please ALTER it as below code.
And if you didn’t created database then create it and set Collation to utf8_unicode_ci
And same for table define Collation as “utf8_unicode_ci” for table fields in which you want to store chines chars.
See the result and step visual as below.