本人用了一段php代码做登录验证,求大神帮忙看看为何无法正常执行,代码如下:
<?php
session_start();
include "lianjieshujuku.php";
$yonghuming=$_POST[*yonghuming*];
$mima=md5($_POST[*mima*]);
$sql="select * from Admin where User=*$yonghuming* and Password=*$mima*";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num>0)
{
$_SESSION[*nowuser*]=$yonghuming;
header("location:index.php");
}
else
{
echo *<a href="denglu.php">您输入的用户名与密码不符,请重输</a>*;
}
?>
代码如上,本人检查了一下,发现当中$num返回的值一直是0,导致无法正常判断,望大神们帮忙!
<?php
session_start();
include "lianjieshujuku.php";
$yonghuming=$_POST[*yonghuming*];
$mima=md5($_POST[*mima*]);
$sql="select * from Admin where User=*$yonghuming* and Password=*$mima*";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num>0)
{
$_SESSION[*nowuser*]=$yonghuming;
header("location:index.php");
}
else
{
echo *<a href="denglu.php">您输入的用户名与密码不符,请重输</a>*;
}
?>
代码如上,本人检查了一下,发现当中$num返回的值一直是0,导致无法正常判断,望大神们帮忙!