$sql = "SELECT post_title, post_body, post_author FROM forum_post WHERE post_id='".$pid."' forum_id='".$id."' AND post_type='o'";
if($topicPost = $mysql->prepare($sql)) {
$topicPost->bind_param('ss',$pid,$id);
$topicPost->bind_result($post_title, $post_body, $post_author);
$topicPost->execute();
$topicPost->store_result();
} else {
echo "ErrorinSQLLL, ".$mysql->error;
exit();
}
So there is my SQL query statement.
I get this printed on my page :
ErrorinSQLLL, 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 'forum_id='1'' at line 1
If needed I can post more of my code.
WHERE post_id='$pid' forum_id='$id'
and then trying to bind$pid
and$id
as well.... but there's no placeholders in the SQL to bind them against.... looks as though you have a fundamental misunderstanding of bind variables that makes your SQL unsafe..... your SQL should beWHERE post_id=? AND forum_id=?
– Mark Baker Feb 11 at 10:43