I have following function
function getQuery($sql,$returnType = ''){
$data = array();
$result = $this->db->query($sql);
if($result){
switch($returnType){
case 'count':
$data = $result->num_rows;
break;
case 'single':
$data = $result->fetch_assoc(); //Line 55
break;
default:
if($result->num_rows > 0){
while($row = $result->fetch_assoc()){
$data[] = $row;
}
}
}
}
if(!empty($data)) {
return $data;
}
return false;
}
When this method is executed following error is returned
Type: Error
Message: Call to undefined method CI_DB_mysqli_result::fetch_assoc()
Line Number: 55
I can't understand why the error is being shown. Please help!!!