trying proper code now

master
LinuxMint4Ever 2020-02-20 01:02:31 +01:00
parent 171b99b2d6
commit b6833c099c
1 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,12 @@ $password = $_POST['password'];
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$statement = $pdo->prepare('SELECT id, name, authentication_algorithm, authentication_string FROM users;');
$statement = $pdo->prepare('SELECT id, name, authentication_algorithm, authentication_string FROM users WHERE name = :username;');
$result = $statement->execute(array('username' => $username));
echo $result[0]['name'];
if ($result) {
//existing user name
print_r($statement->fetch());
} else {
//wrong user name
}
?>