自从我为我的网站聘请了一位新开发人员以来,这个错误就开始了。 它只是回声错误!当它显然是正确的登录细节时。
你能帮助我吗?
<?php
include "global.php";
?>
<h2>Login</h2>
<?php
echo "We currently have <b>" . $usercount . "</b> members, <b>" . $onlinecount . "</b> of which are online. ";
?>
<br>
<br>
<?php
if(isset($_POST["email"])){
$email = $_POST["email"];
$password = sha1($_POST["password"]);
$check = mysqli_num_rows($con, "SELECT * FROM Earth WHERE `email`='$email' AND `password`='$password'");
if($check == 1){
echo "Logged in!";
}
else {
echo "WRONG!";
}
}
?>
<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
Email <input name="email" placeholder="Email Address" required="" type="text"><br>
Password <input name="password" placeholder="Password" required="" type="password"><br>
<input type="reset" value="Start Over">
<input type="submit" value="Login">
</form>
答案 0 :(得分:2)
见这里
$check = mysqli_num_rows($con, "SELECT * FROM Earth WHERE `email`='$email' AND `password`='$password'");
您需要使用代码中缺少的 mysqli_query()
来执行查询。