Q:

error to do with endwhile in php code while makeing forum

My new error is this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND type='o'' at line 1
can somebody help fix this and any other errors in this code:
<?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!"); }
//Check to see if the id is a valid id
$idCheck = $db->query("SELECT * FROM forum_tabl WHERE forum_id = '$id'");
if($idCheck->num_rows !==1){
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_param('s', $id);
    $query->bind_result($post_id, $post_title);
    $query->execute();
    $query->store_result();
}else{
    echo $db->error;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title><?php= $row->forum_name?>!</title>
<html>
<head>
<body>
<div id="page">
<center><h1>Welcome to Our forms.</h1></center>
<h2>Our minecraft forum is displayed below</h2>
<table width="100%">
<?php if($query->num_rows!=0):?>
<?php while($query-fetch()):?>
<tr>
<td><?- $post_title?></td
</tr>

<?php endwhile;?>
<?php else:?>
<tr>
<td><p>No Posts yet!</p></td>
</tr>
<?php endif;?>

</html>
</head>
</body>

A:

You should replace semicolon with colon :
<?php while($query->fetch()): ?>
  <tr>
    <td><?- $post_title?></td
  </tr>
<?php endwhile;?>

Same for the if and endif condition.

