Heim >Backend-Entwicklung >PHP-Tutorial >php对应查寻,求指导
php对应查找,求指导
想通过用户名和问题找回密码,这样写错在哪?
(已知数据库里用户名不重复)
$username = $_POST['username'];
$fquestion = $_POST['fquestion'];
$answer= $_POST['answer'];
include('conn.php');
mysql_query("set character set 'gbk'");
mysql_query("set names 'gbk'");
$sql = "select *from user where username='".$username."' and answer='".$answer."' ";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num>0)
{
echo "你的密码是['password']";
echo"点击此处登入";
}
?>
------解决方案--------------------
$sql = "select <span style="color: #FF0000;">*</span>from user where username='".$username."' and answer='".$answer."' ";