Read from the MySQL data are garbled, to help, the first issue of the new year paste, thank you AH

Source: Internet
Author: User
The data read from MySQL is garbled, ask for help, the first issue of the new Year affixed, thank you Ah!




Untitled Document





Header ("Content-type:text/html;charset=utf-8");



$conn =mysql_connect (' localhost ', ' root ', ');
mysql_select_db (' Test ');
$xieru = "SELECT * from ' content '";
$result =mysql_query ($xieru, $conn);


for ($count =0; $count <10; $count + +)
{

Echo mysql_result ($result, $count, "people"). "
";

echo "
";
}
?>


such as the above code, from the table content read out the data field people, how to operate is garbled, the database is UTF-8 code, to help,


------Solution--------------------
What do you see in the phpMyAdmin?
Put a picture on it.
------Solution--------------------
Before querying the data, set the following encoding

mysql_select_db (' Test ');
mysql_query ("Set names UTF8");
$xieru = "SELECT * from ' content '";
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.