I have been struggling with this , I couldn't get the query to , when I click the link to the post I have getting the id of the post, but whenever I add that's update query I always end up with error 500 work please kindly assist I will so much appreciate
<?php
if(!isset($_GET['id'])) {
header('Location: question.php');
exit();
} else {
$id = $_GET['id'];
}
//include database connection
require_once('./includes/connection.php');
if(!is_numeric($id)) {
header('Location: question.php');
}
$sql = "UPDATE posts SET title = :title, body = :body, category_id = :category_id WHERE post_id = :post_id";
// Prepare the query
$query = $db->prepare($sql);
$query->bindParam(':post_id', $id);
$query->execute();
?>
<?php include 'header.php';?>
<div><?php echo $id ?>
<?php include 'footer.php';?>