From c84215091e914c81937c3aad2f1fd1775f556aa6 Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Sun, 21 Mar 2021 17:37:13 -0600
Subject: Changes from procedural to OOP
---
thread.php | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
(limited to 'thread.php')
diff --git a/thread.php b/thread.php
index 9c43217..3a65114 100644
--- a/thread.php
+++ b/thread.php
@@ -19,24 +19,15 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
subject; ?>
- created by user->name'; ?>
+ created by author->name; ?>
in category->name; ?>
3 days ago
get_posts($dbc);
- $sql = "SELECT post_id, post_content, post_date, post_author, user_id, user_name FROM posts LEFT JOIN users ON post_author = user_id WHERE post_thread = " . mysqli_real_escape_string($dbc, $_GET['id']);
- $result = mysqli_query($dbc, $sql);
-
- if (!$result) {
- die('Error trying to display posts: ' . mysqli_error($dbc));
- }
-
- if (mysqli_num_rows($result) == 0) {
- echo '';
- } else {
- display_posts($dbc, $_GET['id'], $result);
+ foreach ($posts as $post) {
+ $post->display_content();
}
?>
--
cgit v1.2.3