我正在尝试使用PDO检查用户是否存在,然后如果密码正确,是否有办法进行这项工作?还是我需要2个查询?
$sql = "SELECT * FROM login WHERE user = :username AND password = :password";
$result = $statement->fetchAll();
<?php if (isset($_POST['submit']) && count($result["name"]) < 1) { ?>
<div class="sticky-top alert alert-danger" role="alert"> <?= $username ?> could not be found. </div>
<?php } ?>