diff options
author | Cflip <36554078+cflip@users.noreply.github.com> | 2021-01-24 14:14:29 -0700 |
---|---|---|
committer | Cflip <36554078+cflip@users.noreply.github.com> | 2021-01-24 14:14:29 -0700 |
commit | 21ed9dbdfdebc4aef497a9b2ac24e0a0493742d6 (patch) | |
tree | 000be9e6070dbb6a7f6162db41317b6058bac9c3 | |
parent | 147eadd2c2bb6c8c2c9e238a82296c8a840c4aa8 (diff) |
Show user's threads on user page
-rw-r--r-- | user.php | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,6 +1,7 @@ <?php include_once 'header.php'; include_once 'includes/db_inc.php'; +include_once 'includes/functions_inc.php'; ?> <?php @@ -35,8 +36,21 @@ if (!isset($_GET['id'])) { if ($_SESSION['user_id'] == $_GET['id']) { echo '<br><p><a href=change_passw.php>Change Password</a></p>'; } + + echo '</section>'; + + $sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name, cat_id, cat_name FROM threads JOIN users ON thread_author = user_id JOIN categories ON thread_cat = cat_id WHERE thread_author = " . $user['user_id'] . " ORDER BY thread_id DESC"; + $result = mysqli_query($dbc, $sql); + + if (!$result) { + die('Error trying to display threads: ' . mysqli_error($dbc)); + } + + echo '<table><tr><th class="left">' . $user['user_name'] . '\'s Threads</th><th class="right">Latest Post</th></tr>'; + display_threads($dbc, $result, true); + mysqli_free_result($result); + echo '</table>'; } ?> -</section> <?php include_once 'footer.php'; ?> |