I am trying to go to the admin panel of my codeigniter project but. I am facing an error. which is Trying to access array offset on value of type bool
on view file --
<?php
$report_list = get_ci_value("reports_list");
if( count((array)$report_list) == 1){
foreach ((array)$report_list as $row){
$id = strtolower( str_replace(" ", "_", $row['name']) );//the error is showing on this line
if(!segment(3) == $id){
redirect( get_module_url("index/".$id) );
}
}
}
?>
controller--
foreach ($tab_groups as $tab => $data) {
foreach ($data as $main => $row) {
if( isset( $row['sub_menu'] ) ){
usort( $row['sub_menu'] , function($a, $b) {
return $a['position'] <=> $b['position'];
});
$menu_groups[$tab][$main] = $row;
}else{
$menu_groups[$tab][$main] = $row;
}
}
}
if(isset($menu_groups[2])){
$CI->reports_list = $menu_groups[2];
}else{
$CI->reports_list = false;
}
I already tried this but it's not working. then another error comes- Undefined variable: id
if( is_array($row) ) {
$id = strtolower( str_replace(" ", "_", $row['name']) );
}
How can I solve this problem Trying to access array offset on value of type bool ? I am using php 7.4.11