login.php 페이지에 그냥 갇혀있는 index.php 페이지에 로그인 할 수없는 이유는 무엇입니까? 도와주세요. 감사.PHP 로그인 index.php에 로그인 할 수 없습니다.
<?php
session_start();
$conn = new PDO('mysql:host = localhost;dbname=userdb','root','');
if (isset($_POST['login'])){
$username = $_POST['username'];
$password = $_POST['password'];
$query = $conn->prepare("SELECT COUNT('userID') FROM 'tbl_account' WHERE 'username' = '$username' AND 'password' = '$password' ");
$query->execute();
$count = $query->fetchColoumn();
if ($count == 1){
$_SESSION['username'] = $username;
header("location : index.php");
exit();
}else{
$error = "Your Login Name or Password is invalid";
}
}
?>
<html>
<head>
<title>Login</title>
</head>
<body>
<form action = "?" method = "POST">
<input type = "text" name="username"><br> //username
<input type = "password" name = "password"><br> //password
<input type = "submit" name = "submit" value = "Login"> /button
</form>
</body>
</html>
아마도 내 실수 일 수 있습니까? 내 PDO에? 준비된 성명서에? TIA
같은 것을보십시오. 그리고 http://php.net/manual/en/pdostatement.bindparam.php을 읽어야합니다 – Saty
나는 당신의 성명서를 좋아합니다. – revo