使用PHP和MySql数据库设置WebPages标题

So I have a database the program runs fine connects and all except for one thing I am trying to get the "forum_name" defined under my db and set it as my Title. Pretty much if I click on the link where it takes me to that post or forum page it will get whats under forum_name and print it as the Title.

This is db_connect.php

<?php
$db = new mysqli("localhost", "root", "","forum") or die("ERROR: With Connecetion");
 ?>

And this is the Reset:

<?php
session_start();
require"db_connect.php";
//get the page id
if(isset($_GET['id']) &&is_numeric($_GET['id'])){
    $id = $_GET['id'];
}else{
    die("Error! Does not exist!");
}
//check if Valid Id
 $idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = 'id'");
 if($idCheck->num_rows !==0){
     die("error");
 }
 $row = $idCheck->fetch_object();
 $sql = "SELECT post_id, post_title FROM forum_post WHERE forum_id? AND type= 'o'";
 if($query = $db->prepare($sql)){
     $query->bind_params('s', $id);
     $query->bind_result($post_id, $post_title);
     $query->execute();
     $query->store_result();
 }
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?= $row->forum_name?></title>
</head>

<body>

<div id="container">
    <!-- Theres content that will go here -->
</div>

</body>
</html>

I think the Problem is in this line.

$idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = 'id'");

and You have to replace it as follows.

$idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = '$id'");
<?php
session_start();
require"db_connect.php";
//get the page id
if(isset($_GET['id']) &&is_numeric($_GET['id'])){
    $id = $_GET['id'];
}else{
    die("Error! Does not exist!");
}
//check if Valid Id
 $idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = " . $id);
 if($idCheck->num_rows !==0){
     die("error");
 }
 $row = $idCheck->fetch_object();
 $sql = "SELECT post_id, post_title FROM forum_post WHERE forum_id? AND type= 'o'";
 if($query = $db->prepare($sql)){
     $query->bind_params('s', $id);
     $query->bind_result($post_id, $post_title);
     $query->execute();
     $query->store_result();
 }
?>

The " . $id); is what you are looking for to get this to work. You may want to go through and double check everything such as "forum_tabl" and be sure everything is correct if you have not done so already.

Also double check the following, that extra ? may be messing things up as well depending on your database setup.

 $sql = "SELECT post_id, post_title FROM forum_post WHERE forum_id? AND type= 'o'";

Best of luck!