The data read from MYSQL is garbled. for help, please post the first question in the New Year. thank you! & Lt ;! DOCTYPE & nbsp; html & nbsp; PUBLIC & nbsp; "-// W3C // DTD & nbsp; XHTML & nbsp; 1.0 & nbsp; transitional // EN "& the data read from MYSQL is garbled. for help, please post the first question in the New Year. thank you!
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 code above, read the data field PEOPLE from the table CONTENT, how the operation is garbled, the database is the UTF-8 code, ask for help,
------ Solution --------------------
What do you see in phpmyadmin?
I also need to post a picture.
------ Solution --------------------
Set the encoding before querying data.
mysql_select_db('test');
mysql_query("set names utf8");
$xieru="SELECT * FROM `content`";