From df49a36e140acc211fdc31480d40281404110310 Mon Sep 17 00:00:00 2001 From: Cflip <36554078+cflip@users.noreply.github.com> Date: Fri, 22 Jan 2021 20:45:43 -0700 Subject: Inital commit with existing code --- category.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 category.php (limited to 'category.php') diff --git a/category.php b/category.php new file mode 100644 index 0000000..4e10444 --- /dev/null +++ b/category.php @@ -0,0 +1,49 @@ +'; + +$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 '
Topic | Latest Post |
---|---|
';
+ echo '' . $row['topic_subject'] . ''; + echo 'by ' . $row['user_name'] . ' on ' . date('M d, Y', strtotime($row['topic_date'])) . ' | 24 replies |