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'];
}