CodeIgniter Forums
Error: Trying to access array offset on value of type null - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Error: Trying to access array offset on value of type null (/showthread.php?tid=83496)



Error: Trying to access array offset on value of type null - Tajar_Dobro - 09-30-2022

Hi CodeIgniters, i have an issue with one of my functions, locally there is working with no problems, when i upload on web server it gives me error :
A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type null

Filename: helpers/common_helper.php

Line Number: 70

Backtrace:

File: /var/www/html/application/helpers/common_helper.php
Line: 70
Function: _error_handler

File: /var/www/html/application/controllers/Gift.php
Line: 115
Function: get_state_name_by_id

File: /var/www/html/index.php
Line: 315
Function: require_once

---------------------------------------------
the function get_state_name_by_id is as follows
function get_state_name_by_id($id){
    $ci = & get_instance();
    $ci->db->where('state_id',$id);
    return $ci->db->get('state')->row_array()['name'];
}

I use PHP Version 7.4.30 both locally and in web server