我的库文件中有一个mysqli错误{ERROR :: mysqli_fetch_assoc()期望参数1为mysqli_result,null给定}

I have a mysqli error in my library file ERROR :: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given any one help me to solve it

My Installer file:

public function __construct()
    {
        $CI = &get_instance();
        $CI->load->database();
        if ($CI->db->database == '') {
            header('location:install/');
        } else {
            //query from installer tbl
            $installer = mysqli_query('SELECT installer_flag FROM installer');
            $item = mysqli_fetch_assoc($installer);
            $flag = $item['installer_flag'];
            // if installer_flag = 0
            if ($flag == 0) {
                // make it 1
                mysqli_query('UPDATE installer SET installer_flag=1 WHERE id=1');
                if (is_dir('install')) {
                    header('location:install/success.php');
                }
            }
            //run this code
            //else nothing
        }
    }

Error: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given

if you are using CI then use its inbuilt functions to get the result

$query = $this->db->query('SELECT installer_flag FROM installer');
foreach ($query->result_array() as $row)
{
   echo $row['title'];
}

1st : mysqli_query expects two parameter first parameter is connection object second parameter is sql query

example :

mysqli_query($connection_object,$query);

Codeingniter :

$result = $this->db->query('SELECT installer_flag FROM installer')->result();
print_r($result);