1 回答
TA贡献1812条经验 获得超5个赞
你的代码中有很多错误......
试试这个,希望它有效:
<?php
// Grab User submitted information
$email = $_POST["users_email"];
$pass = $_POST["users_pass"];
// Connect to the database
$con = mysqli_connect("localhost", "root", "", "my_dbname"); //Why complicate life?!
// Make sure we connected successfully
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit;
}
$result = mysqli_query($con, "SELECT users_email, users_pass FROM users WHERE users_email = $email");
$row = mysqli_fetch_array($result);
if ($row["users_email"] == $email && $row["users_pass"] == $pass)
echo "You are a validated user.";
else
echo "Sorry, your credentials are not valid, Please try again.";
?>
- 1 回答
- 0 关注
- 88 浏览
添加回答
举报