I get error while running this code in my home page Im trying to get number of registered accounts on my website
code:
function user_count(){
$query = mysqli_query($GLOBALS["con"], 'SELECT COUNT user_id FROM users WHERE active = 1');
$row = mysqli_fetch_assoc($query);
return $row;
}
$GLOBALS["con"] is defined in another place as
$GLOBALS["con"] = mysqli_connect("localhost","root","","Login");
I get this error on my page:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /Applications/XAMPP/xamppfiles/htdocs/core/functions/users.php on line 4
Any ideas on this? I would like to resolve this problem...