prepare("SELECT * FROM users WHERE username = ?"); $stmt->bind_param("s", $username); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 1) { $user = $result->fetch_assoc(); if (password_verify($password, $user["password"])) { $_SESSION["data"] = $user; header("Location: home"); exit; } else { $error = "Wrong Username or Password."; } } else { $error = "Username not found."; } } ?>