Skip to content

Commit

Permalink
Changed get_user db prepared statement style to non-PDO (fixes #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
glacials committed Oct 3, 2013
1 parent df12182 commit 3b858e3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions classes/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ public function __construct() {
public function get_user($id) {
// TODO: This ain't tested yet
$statement = $this->connection->prepare('SELECT user_id, username, password_hash, is_admin, gender FROM Users WHERE user_id = ?');
if ($statement->execute(array($id))) {
$row = $statement->fetch();
return new User($row['user_id'],
$row['username'],
$row['password_hash'],
$row['is_admin'],
$row['gender']);
$statement->bind_param('i', $id);
if ($statement->execute()) {
$statement->bind_result($id, $username, $password_hash, $is_admin, $gender);
$statement->fetch();
return new User($id, $username, $password_hash, $is_admin, $gender);
}
return false;
}
Expand Down

0 comments on commit 3b858e3

Please sign in to comment.