PHP Warning: mysql_fetch_array() expects parameter 1 to be resource报错
if(empty($_POST["yd631_name"])){echo("<scripttype='text/javascript'>alert('用户名怎么能是空的呢...
if(empty($_POST["yd631_name"])){
echo ("<script type='text/javascript'> alert('用户名怎么能是空的呢!');history.go(-1);</script>");
}
if(empty($_POST["yd631_pws"])){
echo ("<script type='text/javascript'> alert('密码也不能是空的!');history.go(-1);</script>");
}
$yd631_name= $_POST["yd631_name"]; //用户名已经记录了
$yd631_pws= $_POST["yd631_pws"]; //密码已经记录了
$db=mysql_connect($servername,$sqlservername,$sqlserverpws);
mysql_select_db($sqlname,$db);
$sql="select * from $sqltable where yd631_name='$yd631_name' and yd631_pws='$yd631_pws'";
$result=mysql_fetch_array(mysql_query($sql));----------这行报错
if(!$result){
echo ("<script type='text/javascript'> alert('用户名或密码不正确!');history.go(-1);</script>");
mysql_close();
exit;
}
if($result["yd631_pass"]=="no"){
//验证会员是不是被审核通过了
echo ("<script type='text/javascript'> alert('您还没有被审核呢!');history.go(-1);</script>");
}
session_start();
$_SESSION["name"]="$yd631_name";
echo "<script>location.href='yd631.php';</script>";
?>
请问如何解决? 展开
echo ("<script type='text/javascript'> alert('用户名怎么能是空的呢!');history.go(-1);</script>");
}
if(empty($_POST["yd631_pws"])){
echo ("<script type='text/javascript'> alert('密码也不能是空的!');history.go(-1);</script>");
}
$yd631_name= $_POST["yd631_name"]; //用户名已经记录了
$yd631_pws= $_POST["yd631_pws"]; //密码已经记录了
$db=mysql_connect($servername,$sqlservername,$sqlserverpws);
mysql_select_db($sqlname,$db);
$sql="select * from $sqltable where yd631_name='$yd631_name' and yd631_pws='$yd631_pws'";
$result=mysql_fetch_array(mysql_query($sql));----------这行报错
if(!$result){
echo ("<script type='text/javascript'> alert('用户名或密码不正确!');history.go(-1);</script>");
mysql_close();
exit;
}
if($result["yd631_pass"]=="no"){
//验证会员是不是被审核通过了
echo ("<script type='text/javascript'> alert('您还没有被审核呢!');history.go(-1);</script>");
}
session_start();
$_SESSION["name"]="$yd631_name";
echo "<script>location.href='yd631.php';</script>";
?>
请问如何解决? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询