< title></title>
<body>
<?php Eternal Profit Meeting Casino
$mysql _server_name= ' localhost ';
$mysql _username= ' root ';
$mysql _password= ' 000000 ';
$mysql _database= ' Lib ';
$conn =mysql_connect ($mysql _server_name, $mysql _username, $mysql _password, $mysql _database);
$sql = "Select Name,age from MYTB";
Print ($conn);
$rs =mysql_db_query ("Lib", "select * from MYTB", $conn);
Print ("<br>");
while ($row = Mysql_fetch_object ($rs)) {
Print ($row->name. ":" $row->age. " <br> ");
}
Mysql_close ($conn);
?>
Shown below:
Resource ID #1
dd:54
Ddd:8
?? : 15
??? : 25
?? : 32
MySQL code: UTF8,GBK have tried. MySQL font and command line display are correct.
Supplementary questions:
Garbled:
??? : 15
??? : 25
?? : 32
In these lines, the values in the database are Chinese characters. The question mark is displayed.
Workaround:
In $rs=mysql_db_query ("Lib", "select * from MYTB", $conn);
Front Plus
mysql_query ("Set names gb2312"), or mysql_query ("Set names GBK");