Home > Backend Development > PHP Tutorial > 中文查询:select where gender='男' ?解决思路

中文查询:select where gender='男' ?解决思路

WBOY
Release: 2016-06-13 10:14:02
Original
1968 people have browsed it

中文查询: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");

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template