Today, when querying database character fields in PHP, the syntax is exactly the same, but the query is not the result, and in the command line, the same statement can achieve the desired effect. After a lot of understanding, we found that the character encoding does not match the reason. Here, I would like to share with you the process of solving the problem:
First of all, I use XAMPP this software to install, so it may be different from other software. Then, to solve this problem is very simple, we just need to open the phpadmin, and then you want to query the database or table collation to the desired character encoding (such as: GB2312_CHINESE_CI,UTF8_CHINESE_CI, etc.). At the end of the query you will find that the previous problem has been resolved, yes, it is so simple
About XAMPP MySQL character encoding and compiler encoding mismatch problem