'; $sql = "SELECT cat_name, cat_description FROM categories WHERE cat_id = " . mysqli_real_escape_string($dbc, $_GET['id']); $result = mysqli_query($dbc, $sql); if (!$result) { die('Error trying to display category: ' . mysqli_error($dbc)); } // Display category name and description if (mysqli_num_rows($result) == 0) { echo 'This category does not exist'; } else { while ($row = mysqli_fetch_assoc($result)) { echo '

' . $row['cat_name'] . '

'; echo $row['cat_description']; } } mysqli_free_result($result); echo ''; $sql = "SELECT topic_id, topic_subject, topic_date, user_name FROM topics LEFT JOIN users ON topic_author = user_id WHERE topic_cat = " . mysqli_real_escape_string($dbc, $_GET['id']) . " ORDER BY topic_id DESC"; $result = mysqli_query($dbc, $sql); if (!$result) { die('Error trying to display topics: ' . mysqli_error($dbc)); } // Display table of posts echo ''; while ($row = mysqli_fetch_assoc($result)) { echo ''; } echo '
TopicLatest Post
'; echo '

' . $row['topic_subject'] . '

'; echo 'by ' . $row['user_name'] . ' on ' . date('M d, Y', strtotime($row['topic_date'])) . '
by cflip
01-22-2021 9:34
'; include 'footer.php';