Maison >développement back-end >tutoriel php >中文查询:select where gender='男' ?解决思路
中文查询:select where gender='男' ???????????????
$sql= "SELECT ID,username,nichen,gender,hangye FROM UserInfo WHERE gender = '男'";
mysql_connect("localhost", "root", "");
mysql_select_db("mydb");
mysql_query("set names gb2312");
$result = mysql_query($sql);
$recordnum = mysql_num_rows($result);
echo ($recordnum);
?>
结果总是0,怎么办?
注明一下,gender = '男' 已经验证是存在的,我已经
mysql>alter table UserInfo modify gender char(2) character set gb2312;
怎么办????
------解决方案--------------------
那不就对了吗?
------解决方案--------------------
php文件加上: header("Content-Type:text/html;charset=utf-8");