Why can't I search for Chinese characters only by English letters? For example, why can't I search for English letters or Chinese characters in a PHP site? After searching for Chinese characters, the screen is blank. please give me some advice! & Lt ;? Phpif (! Mysql_connect ("localhost", "admin", "admin") Why can't I search for Chinese characters only by English letters?
For example, why can't I search for English letters or Chinese characters in a PHP site?
After searching for Chinese characters, the screen is blank. please give me some advice!
If (! Mysql_connect ("localhost", "admin", "admin "))
Die ("cocould not connect:". mysql_error ());
Mysql_select_db ("cesf ");
$ Query = "set names 'gb2312 '";
Mysql_query ($ query );
?>
$ Keyword = $ _ POST ['keyword'];
$ Contents = array ();
$ Rt = mysql_query ("select * from dede_archives where title like '% $ keyword % '");
While ($ rs = mysql_fetch_array ($ rt ))
{
$ Contents [] = $ rs;
}
?>
Query instances
Foreach ($ contents as $ key => $ value ){
Echo"
";
Echo"$ Value [title]";
Echo"";
}
?>
Share:
------ Solution --------------------
Print the SQL statement to check whether the SQL statement is normal (the main reason is that the obtained Chinese parameters may be garbled.
------ Solution --------------------
------ Solution --------------------
Print SQL directly to check whether the database has a value.