php mysql program is displayed in Chinese

Updated on technology 2024-02-09
19 answers
  1. Anonymous users2024-02-05

    This problem is usually caused by inconsistent character sets. To solve this problem once and for all, do the following:

    Set the encoding to UTF8

    1.The encoding of the database.

    When creating a database or table, specify the encoding to UTF8

    2.The encoding of the web page is set to UTF-8 -- note that this is not UTF8 but UTF-8

    3.After connecting to the database, add a mysql query() before executing anything else"set names utf8");

    After this processing, you should be able to get the results you want.

  2. Anonymous users2024-02-04

    First of all, when inserting Chinese characters into the database, the character set should be set to utf8.

    Second, add the following statement after the php file link to the database.

    mysql_query("set names gbk");

    In this way, the inserted Chinese characters will not be displayed??? Finish.

  3. Anonymous users2024-02-03

    You have two questions about this:

    1- When Chinese is displayed?

    This is an encoding issue with the display section, add a line before the display output.

    echo header("content-type: text/html; charset=gb2312");

    If not, check your database encoding and select utf82 when creating a table

    Place this line of statement.

    sql="select * from `jjga`.`humaninfo` where `username`=$name";

    Instead. sql="select * from `jjga`.`humaninfo` where `username`='".$name."'";

    This prevents syntax issues with SQL and is more secure.

  4. Anonymous users2024-02-02

    Look at whether the code of the database is Chinese code, or change it to Chinese code.

  5. Anonymous users2024-02-01

    The encoding of php and database should be consistent.

    1.Modify the MySQL configuration file or, MySQL is best encoded in UTF8 [MySQL].

    default-character-set=utf8[mysqld]

    default-character-set=utf8default-storage-engine=myisam

    default-collation=utf8_bininit_connect='set names utf8'

    2.Add MySQL Query() before the php program that needs to do database operations"set names

    Encoding'");If the PHP encoding is GB2312, then the MySQL encoding is GB2312, if it is UTF-8, then the MySQL encoding is UTF8, so that there will be no garbled characters when inserting or retrieving data.

  6. Anonymous users2024-01-31

    mysql_query("set names 'utf'");Just put it in $conn and you're good to go.

  7. Anonymous users2024-01-30

    Then you try utf8, I use utf8, you can store the man in the database.

  8. Anonymous users2024-01-29

    It depends on the coding of the database.

  9. Anonymous users2024-01-28

    PHP pages are UTF8, right? mysql_query("set name 'gbk' "There's something wrong with the way it was written, it should be.

    mysql_query("set names 'gbk' "If it doesn't work, you can try to change it.

    mysql_query("set names 'utf8' ")

  10. Anonymous users2024-01-27

    You look at what the encoding of the web page you are displaying, as long as the encoding is consistent, there will be no garbled problem.

    If you don't have a mysql field, you can try it with utf8 general ci.

  11. Anonymous users2024-01-26

    Go to MySQL to set, don't set MySQL coding in PHP, garbled code must be a coding problem, it is recommended that you first change the coding of the table in MySQL, and then change the php encoding well, so that it should be no problem.

  12. Anonymous users2024-01-25

    The field and table structure are encoded in UTF8 General CI.

  13. Anonymous users2024-01-24

    Coding issues: The page encoding should be UTF8, live GBK, etc.

  14. Anonymous users2024-01-23

    Codes are specified in both the entry and exit areas.

    You didn't specify a good code.

  15. Anonymous users2024-01-22

    In the database connection **Riga.

    e.g. mysql connect($host, $user, $password);

    mysql_query("set names gbk");

    But the premise is that your database field finishing is also a GBK-related type, otherwise it will be even more messy, haha if it's a UTF8 mysql query("set names utf8");That's it.

  16. Anonymous users2024-01-21

    Your file is not also saved in UTF-8 format.

  17. Anonymous users2024-01-20

    Incorrect coding.

    What is the encoding of the web page, if it is GB2312, in PHP, execute: MySQL Query("set names gb2312');

    If you use utf-8, the set name utf8mysql field, the field involving text, also use the corresponding encoding to read the page with the corresponding encoding.

  18. Anonymous users2024-01-19

    header("content-type:text/html;charset:utf-8")

    Put before the echo output. Or put it on the first line of the program.

  19. Anonymous users2024-01-18

    What format is chosen when the php file is saved. Select UTF8 to try when saving.

Related questions
16 answers2024-02-09

To ensure that Linux displays Chinese, you need to pay attention to the following two points: >>>More

10 answers2024-02-09

Try to use "360 Security Guard" to repair the system first, and remember to reboot. >>>More

10 answers2024-02-09

Theoretically, if the graphics card is broken, it will alarm the boot. >>>More

7 answers2024-02-09

Looks like Intel's integrated graphics? graphics accelerator driver >>>More

6 answers2024-02-09

It should have nothing to do with the climate, it is estimated that it should still be a problem with the program setting, is it unfamiliar or uncolored? The specific question depends on the specific situation.