prepare($sql);
$stmt->bind_param('i', $_GET['id']);
$stmt->execute();
$result = $stmt->get_result();
if(!$result)
{
echo 'The category could not be displayed, please try again later.';
}
else
{
if($result->num_rows == 0)
{
echo 'This category does not exist.';
}
else
{
//display category data
while($row = $result->fetch_assoc())
{
echo '
Topics in ′' . htmlentities($row['catName'], ENT_QUOTES | ENT_HTML5, 'UTF-8') . '′ category
';
}
//do a query for the topics
$sql = "SELECT topicNo, topicSubject, topicDate, topicCat
FROM topics
WHERE topicCat = ?
ORDER BY topicDate";
$stmt = $conn->prepare($sql);
$stmt->bind_param('i', $_GET['id']);
$stmt->execute();
$result = $stmt->get_result();
if(!$result)
{
echo 'The topics could not be displayed, please try again later.';
}
else
{
if($result->num_rows == 0)
{
echo 'There are no topics in this category yet.';
}
else
{
//prepare the table
echo '
| Topic |
Created at |
';
while($row = $result->fetch_assoc())
{
echo '';
echo '| ';
echo ' | ';
echo '';
echo date_format(date_create($row['topicDate']), 'd/m/Y H:i:s');
echo ' | ';
echo '
';
}
//Close the table up
echo '
';
}
}
}
}
include 'footer.php';
?>