I'm trying to generate a pdf report but instead, I'm getting this error:
Type: Error
Message: Cannot use object of type mysqli as an array
MODEL
function pdf($post_id)
{
$result = $this->db->query("SELECT * FROM tb_data_utama WHERE nipBaru='$post_id'");
return $result;
}
CONTROLLER
function getpdf()
{
$this->load->model('model_user');
$this->load->library('pdf');
$post_id = $this->uri->segment(3);
$x['data'] = $this->model_user->pdf($post_id);
$html = $this->load->view('GeneratePdfView', $x, [], true);
$this->pdf->createPDF($html, 'mypdf', false);
}