Unknown category.';
} else {
$sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name FROM threads LEFT JOIN users ON thread_author = user_id WHERE thread_id = " . mysqli_real_escape_string($dbc, $_GET['id']);
$result = mysqli_query($dbc, $sql);
if (!$result) {
die('Error trying to display thread page: ' . mysqli_error($dbc));
}
if (mysqli_num_rows($result) == 0) {
echo 'This thread does not exist';
} else {
while ($row = mysqli_fetch_assoc($result)) {
echo '' . $row['thread_subject'] . '
';
echo 'Created by ' . $row['user_name'] . ' on ' . date('M d, Y', strtotime($row['thread_date'])) . '';
$thread_id = $row['thread_id'];
}
}
echo '';
mysqli_free_result($result);
$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, $result);
}
mysqli_free_result($result);
if (isset($_SESSION['signed_in'])) {
echo '
';
} else {
echo '
';
}
}
include_once 'footer.php';
?>