/ *当我测试登录页面时,我输入我在phpMyAdmin中手动设置的用户帐户的信息,但它一直返回错误,"找不到用户名。" * /
<?php
session_start();
include_once '../../config/dbconfig.php';
if(isset($_SESSION['user'])!="")
{
header("Location:http://www.google.com");
}
if(isset($_POST['btn-login']))
{
$email = mysqli_real_escape_string($con,$_POST['email']);
$upass = mysqli_real_escape_string($con,$_POST['pass']);
$query= "SELECT email, pass from users WHERE email='$email' and pass =$upass'";
$result= mysqli_query($con,$query);
if($result)
{
echo "user found";
}
else
{
echo "user was not found";
}
}
答案 0 :(得分:0)
缺少引语:
$query= "SELECT email, pass from users WHERE email='$email' and pass =$upass'";
应该是:
$query= "SELECT email, pass from users WHERE email='$email' and pass = '$upass'";
引用是在$upass