mysqli_query()期望参数1为mysqli,对象给出[关闭]

I seem to have run into another problem which I can not seem to figure out. I get an error on 2 lines. the errors are:

Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\xampp\htdocs\page.php on line 72

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\page.php on line 73

The main part of the code I am using and which are the problem are as follows:

require('includes/config.php');
$sql = "SELECT avatar FROM members WHERE username='$username' LIMIT 1";
$query = mysqli_query($db, $sql);
$row = mysqli_fetch_row($query);

I can't see why this would produce an error?

use mysqli_error for track error :-

try this code for track your error:-

require('includes/config.php');
$sql = "SELECT avatar FROM members WHERE username='$username' LIMIT 1";
$query = mysqli_query($db, $sql);
if (!$query)
{
echo("Error description: " . mysqli_error($db));
}