为什么PHP站内搜索只能搜索英文和字母,不能搜索中文?
如题:为什么PHP站内搜索只能搜索英文和字母,不能搜索中文?
搜索中文后,显示空白,请大侠们,指点迷津!
<?php<br /> if(!mysql_connect("localhost","admin","admin"))<br /> die("Could not connect:".mysql_error());<br /> mysql_select_db("cesf");<br /> $query="SET NAMES 'GB2312'";<br /> mysql_query($query);<br /> ?><br /> <?php<br /> $keyword=$_POST['keyword'];<br /> $contents= array();<br /> $rt=mysql_query("select * from dede_archives where title like '%$keyword%'");<br /> while ($rs=mysql_fetch_array($rt))<br /> {<br /> $contents[]=$rs;<br /> }<br /> ?><br /> <html><br /> <head><title>查询实例</title></head><br /> <body><br /> <?php <br /> foreach($contents as $key=>$value){<br /> echo "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\" width=\"600\" style=\"border-collapse:collapse;\">";<br /> echo "<tr><td>$value[title]</td></tr>";<br /> echo "</table>";<br /> }<br /> ?><br /> </body><br /> </html>