PHP shows MySQL garbled problem 1. Using the phpMyAdmin operation MySQL database Chinese character display is normal, but the PHP page displays MySQL data when all Chinese characters have become the number.
Symptoms: Using phpMyAdmin to enter Chinese characters is normal, but when the PHP page displays MySQL data, Chinese characters become the number, and how many Chinese characters there are number. Many students are experiencing this problem, especially after installing the latest version of Appserv. For this reason many students abandoned PHP, modified to learn ASP.
Reason: There is no code in the PHP Web page to tell MySQL what character set to output Chinese characters.
★php display MySQL garbled solution: This is not garbled, as long as the PHP page header to add the following section of code to tell MySQL to UTF8 encoded output of Chinese characters can
- <?>
- You can also insert the above code snippet directly into the PHP code section of the Web page (i.e. remove both ends < ?? > No.). For example, if you use Dreamweaver to connect to a database, you can connect the code in the header
- < Add the code to the?> to turn it into
- < ?
- PHP require_once (' connections/connmessage.php ');
- mysql_query ("SET NAMES UTF8");
- ?>
Note: If your page encoding is gb2312, that is SET NAMES GB2312. But editors strongly recommend page encoding, MySQL data table character set, phpMyAdmin all unified use UTF8. Please see the 2nd section of the first chapter of PHP tutorial.
PHP shows MySQL garbled problem 2. An error occurred while entering data with phpMyAdmin, and no input or garbled characters were allowed
★php shows MySQL garbled solution: This is a setup issue. Please install the latest version of phpMyAdmin or Appserv, open the Phpmyadmin,mysql character set: UTF-8 Unicode (UTF8); MySQL connection proofreading should be utf8_unicode_ci When you create a new database, organize a column and select it as Utf8_unicode_ci. The web character set is also best chosen UTF8. UTF8 is the international standard coding, is the trend. How to change the page encoding please see this site PHP Tutorial chapter 2nd, section I.
PHP shows MySQL garbled problem 3. In this machine developed a good MySQL data table, in the native test everything is normal, but with the website space provider of phpMyAdmin upload but there is a problem, upload failed. Especially the use of foreign php space.
★php display MySQL garbled solution: First look at the phpMyAdmin character set set provided by the website space quotient, make sure that the data table you built is the same code as space. MySQL in foreign countries do not support gb2312, even the latest version of Appserv also does not support gb2312. If it is because the coding is not uniform, the data table can be rebuilt, of course, with the international standard UTF8.
http://www.bkjia.com/PHPjc/446269.html www.bkjia.com true http://www.bkjia.com/PHPjc/446269.html techarticle PHP Display MySQL garbled problem 1. Use phpMyAdmin to operate MySQL database Chinese characters display normally, but all Chinese characters have become the number when displaying MySQL data with PHP Web page. Symptom: Enter Han ... with phpmyadmin ...