Hi i have this function below....
biut i keep geting this warning message Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean
i get this message when i run the function and set it $id, im not sure if the isset in this query is actually workin
could someone please help.
Kind Regards
function get_posts($id = null, $cat_id = null){
global $dbc;
$posts = array();
$query = "SELECT b.message as bmsg, b.ID as bid, b.subject, b.post_on, c.ID, c.blog_id, c.message as mgs FROM blog as b LEFT JOIN comments as c ON b.ID = c.blog_id GROUP BY bmsg";
if(isset($id)){
$query .= "WHERE b.ID = '$id'";
}
$query = mysqli_query($dbc ,$query);
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$posts[] = $row;
}
return $posts;
}