Warning: mysql_num_rows(): supplied argument is not a valid MySQL resultresource in
<?phpsession_start();$conn=mysql_connect(localhost,"root","123456");if(!$conn){die("连...
<?php
session_start();
$conn=mysql_connect(localhost,"root","123456");
if(!$conn)
{
die("连接错误的原因:".mysql_error());
}
$name=$_POST[name];
$password=$_POST[password];
if($_session[name]=="ture")
{
echo "用户已经登录";
}
if($_POST[name] && $_POST[password])
{
mysql_select_db("admin",$conn);
$sql="SELECT *FROM admin WHERE admin_name='$name' AND password='$password'";
$result=mysql_query($sql);
$rew=mysql_num_rows($result);
if($rew)
{
$_session[name]="ture";
echo "登录成功";
}
else
{
$_session[name]="flase";
echo "登录不成功";
}
}
else
{
echo "用户名和密码是空的!";
}
mysql_close($conn);
?>
运行时出现“Warning: mysql_num_rows(): supplied argument is not a valid MySQL resultresource in F:\CS\gl\yz.php on line 20 展开
session_start();
$conn=mysql_connect(localhost,"root","123456");
if(!$conn)
{
die("连接错误的原因:".mysql_error());
}
$name=$_POST[name];
$password=$_POST[password];
if($_session[name]=="ture")
{
echo "用户已经登录";
}
if($_POST[name] && $_POST[password])
{
mysql_select_db("admin",$conn);
$sql="SELECT *FROM admin WHERE admin_name='$name' AND password='$password'";
$result=mysql_query($sql);
$rew=mysql_num_rows($result);
if($rew)
{
$_session[name]="ture";
echo "登录成功";
}
else
{
$_session[name]="flase";
echo "登录不成功";
}
}
else
{
echo "用户名和密码是空的!";
}
mysql_close($conn);
?>
运行时出现“Warning: mysql_num_rows(): supplied argument is not a valid MySQL resultresource in F:\CS\gl\yz.php on line 20 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |