'로그인'을 클릭하면 데이터베이스에 사용자가 있는지 확인하고 싶습니다. 그렇다면 "사용자 존재"를 표시하고 그렇지 않으면 "사용자 존재하지 않음"을 표시합니다. 이 일에 어떻게 가야합니까? 지금까지 내가 가지고 :SQL 데이터베이스에 사용자가 있는지 확인하는 방법
내 로그인에<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<form method="post" action="login.php">
Username: <input type="text" value="" name="username" /><br /><br />
Password: <input type="password" value="" name="password" /><br /><br />
<input type="submit" name="submit" value="Log In"/>
</form>
</body>
</html>
힌트 :'SELECT COUNT (*) ... ' – zerkms