中文查询:select where gender='男' ?解决思路
程序员文章站
2022-05-31 08:05:55
...
中文查询: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");
$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");
相关文章
相关视频