I am creating a blog and the following function has been created to take the topics of the blog:
function getPostTopic($post_id) {
global $conn;
$sql = "SELECT * FROM topics WHERE id=
(SELECT topic_id FROM post_topic WHERE post_id=$post_id) LIMIT 1";
$result = mysqli_query($conn, $sql);
$topic = mysqli_fetch_assoc($result);
return $topic;
}
Which gives me an error:
Warning: mysqli_fetch_assoc () expects parameter 1 to be mysqli_result, boolean given in C: \ wamp \ www \ includes \ public_functions.php on line 30