1

I get these errors when I go the Reports.php page:

A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 0
Filename: controllers/Reports.php
Line Number: 73
Backtrace:
File: C:\xampp\htdocs\restaurant\application\controllers\Reports.php
Line: 73
Function: _error_handler
File: C:\xampp\htdocs\restaurant\index.php
Line: 315
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: controllers/Reports.php
Line Number: 88
Backtrace:
File: C:\xampp\htdocs\restaurant\application\controllers\Reports.php
Line: 88
Function: _error_handler
File: C:\xampp\htdocs\restaurant\index.php
Line: 315
Function: require_once

This is line 73 in Reports.php:

$store_id = $store_data[0]['id'];

This is line 88 in Reports.php:

foreach ($order_data as $k => $v) {

This is line 315 in index.php:

require_once BASEPATH.'core/CodeIgniter.php';
showdev
  • 28,454
  • 37
  • 55
  • 73
  • `$store_data[0]['id'];` the 0 of that array does not exist. you want to check whats in `$store_data` `var_dump( $store_data);` –  Jul 20 '19 at 05:31
  • See [Notice: Undefined Index](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/12770836#12770836) and [Invalid argument supplied for foreach()](https://stackoverflow.com/questions/2630013/invalid-argument-supplied-for-foreach). – showdev Jul 20 '19 at 05:31
  • your `store_data` array does not have any element on zero place to check your array you can use `print_r(store_data)`. – CodeBreaker Jul 20 '19 at 05:36
  • Possible duplicate of [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – atymic Jul 20 '19 at 06:00
  • Possible duplicate of ["Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP](https://stackoverflow.com/questions/4261133/notice-undefined-variable-notice-undefined-index-and-notice-undefined) – Dharman Jul 20 '19 at 06:05

0 Answers0