I want to check if the user exists in the database when clicking 'log in'. If so, echo "user exists" and if not "user does not exist". How can i go about this? so far i have:
<?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(*) ...