What am I doing wrong with this simple function? The code works above the <hr> tag, but I get a: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given… Error when using the function.
[code=php]
<?php
function database_query($query_name, $database_query){
global $dbc;
$query_name = mysqli_query($dbc, $database_query) or die(“Problem Querying “.mysqli_error($dbc));
return $query_name;
}
$comment_count = “SELECT * FROM comments WHERE photo_id = $image_id”;
$count_comments = mysqli_query($dbc, $comment_count) or die(“Problem”);
echo mysqli_num_rows($count_comments);
echo “<hr />”;
database_query($count_comments, $comment_count);
echo mysqli_num_rows($count_comments);
?>
Thanks in advance
?