Home  >  Article  >  Backend Development  >  Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result reso,该怎么解决

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result reso,该怎么解决

WBOY
WBOYOriginal
2016-06-13 11:57:391518browse

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result reso
为什么查询的内容没有显示





查询条件: 
关键字






if(isset($_POST[search_key])){
$tj=$_POST[sel_tj];
$key=$_POST[search_key];
$sql=mysql_query("select * from bg_user where $tj='$key'",$_link);
$result=mysql_fetch_array($sql); 
if($result!=false){
echo "<script>alert('对不起,该用户不存在!');</script>";
}else{
do{
?>
































用户管理
姓名: 性别: =$result['sex']?>
邮箱: QQ: =$result['QQ']?>
个人主页: =$result['homepage']?>
IP地址: 生日: =$result['birthday']?>
现住城市: =$result['city']?>
家庭住址: =$result['addr']?>

}while($result=mysql_fetch_array($sql));
}
}
?>

------解决方案--------------------
查询失败了!
$sql=mysql_query("select * from bg_user where $tj='$key'",$_link) or die(mysql_error());
------解决方案--------------------
逻辑写反了,if($result!=false)这个该循环输出内容的,你alert了。
------解决方案--------------------
没有名为“用户名”的列

Statement:
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