From 7c3f2e348c015ea93563d866f89ec8cea9159ea0 Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sat, 24 Apr 2021 09:40:20 -0600 Subject: Refactoring part 2 Starting to move some functionality such as the session and database connection into singleton classes to manage them. Functions for modifying posts and threads are being put in one place as well. --- includes/model/User.php | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'includes/model/User.php') diff --git a/includes/model/User.php b/includes/model/User.php index 1c48afb..c780ff0 100644 --- a/includes/model/User.php +++ b/includes/model/User.php @@ -1,14 +1,17 @@ id = $id; - $this->name = $row['user_name']; - $this->date = $row['user_date']; - $this->level = $row['user_level']; - } - } - - mysqli_free_result($result); - } + function get_by_id($id) + { + $sql = "SELECT user_name, user_date, user_level FROM users WHERE user_id = ?;"; + $result = Database::get()->query($sql, "i", $id); + $this->id = $id; + $this->name = $result[0]['user_name']; + $this->date = $result[0]['user_date']; + $this->level = $result[0]['user_level']; + } } \ No newline at end of file -- cgit v1.2.3