(as the current mainstream development language)
$MySQL(the best combination with PHP)_server_name=localhost;
$ MySQL(The best combination with PHP)_username=root;
$MySQL(The best combination with PHP)_password=000000;
$MySQL(The best combination with PHP)_database=lib;
$conn=MySQL(The best combination with PHP)_connect($MySQL(With PHP The best combination)_server_name,$MySQL(The best combination with PHP)_username,$MySQL(The best combination with PHP)_password,$ MySQL(The best combination with PHP)_database);
$sql="select name,age from mytb";
print($conn);
$rs=MySQL (The best combination with PHP)_db_query("lib","select * from mytb",$conn);
print("
");
while($row = MySQL(The best combination with PHP)_fetch_object($rs)){
print ($row->name. ":".$row->age."
");
}
MySQL(The best combination with PHP)_close($conn);
?>
is displayed as follows:
Resource id #1
dd:54
ddd:8
??:15
???:25
??: 32
MySQL(The best combination with PHP)Encoding: utf8, GBK have been tried. MySQL(The best combination with PHP) font and command line.
Additional questions:
Garbled characters:
???:15
???:25
??:32
The values in the database are Chinese characters. Question marks are displayed.
Solution:
in $rs=MySQL (the best combination with PHP) _db_query("lib"," select * from mytb",$conn);
is preceded by
MySQL (the best combination with PHP) _query("set names gb2312"); or MySQL( The best combination with PHP)_query("set names gbk");