summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorCflip <36554078+cflip@users.noreply.github.com>2021-01-24 14:14:05 -0700
committerCflip <36554078+cflip@users.noreply.github.com>2021-01-24 14:14:05 -0700
commit147eadd2c2bb6c8c2c9e238a82296c8a840c4aa8 (patch)
treed9588a6e141384d8329ea0951badbb8edb31bb0e /index.php
parent6500ec0543a316f9fa5f16a5c47e7103ec9bbe9e (diff)
Create function to display threads
Diffstat (limited to 'index.php')
-rw-r--r--index.php10
1 files changed, 3 insertions, 7 deletions
diff --git a/index.php b/index.php
index fabec83..3672dbe 100644
--- a/index.php
+++ b/index.php
@@ -57,24 +57,20 @@ include_once 'header.php';
<table>
<tr>
<th class="left">Latest Threads</th>
- <th class="right">Categories</th>
+ <th class="right">Latest Post</th>
</tr>
<?php
include_once 'includes/db_inc.php';
+ include_once 'includes/functions_inc.php';
$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 ORDER BY thread_id DESC LIMIT 5";
$result = mysqli_query($dbc, $sql);
if (!$result) {
die('Error trying to display threads: ' . mysqli_error($dbc));
- }
-
- while ($row = mysqli_fetch_assoc($result)) {
- echo '<tr><td class="left">';
- echo '<h4><a href="thread.php?id=' . $row['thread_id'] . '">' . $row['thread_subject'] . '</a></h4>';
- echo '<small>by <b><a href="user.php?id=' . $thread['user_id'] . '">' . $row['user_name'] . '</a></b> on ' . date('M d, Y', strtotime($row['thread_date'])) . '</small></td><td class="right">Posted in <a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] .'</a></td></tr>';
}
+ display_threads($dbc, $result, true);
mysqli_free_result($result);
?>
</table>