Skip to content
Snippets Groups Projects
Commit 848490b1 authored by Iqbal's avatar Iqbal
Browse files

Added GetAllUsernameAndPassword method

parent 36b4a771
Branches
No related merge requests found
......@@ -37,6 +37,19 @@ class User {
}
}
public static function GetAllUsernameAndPassword(PDO $conn) {
try {
$users = $conn->query("SELECT username, password FROM user")->fetchAll();
foreach ($users as $record) {
$result[$record['username']] = $record['password'];
}
return $result;
} catch (PDOException $e) {
echo "Error: ".$e->getMessage();
return false;
}
}
public static function GetUserById($id, PDO $conn) {
try {
$stmt = $conn->prepare("SELECT * FROM user WHERE id=?");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment