0
     $a = explode(",",$data['ids'][$i]);   
  $dbtvalues = array();
                for($j=0;$j< count($a);$j++)
                {   
                    $dbtvalues['serial_no'] =$a[$j];
                    if($data['modelno'] !="select")

                    {
                    $dbtvalues['model_no'] = $data['modelno'][$j];
                    }

                    $dbtvalues['indent_detail_id1'] = (int)$last_id ;
                    $data['indent_req_detail_id'][$i];

                    $this->outpatient_model->insert_row('tra_indent_issue_detail',$dbtvalues);

                }

$a need to explode and insert into db if array has 5 values 5 rows must be inserted into table.

getting error message as :

Severity: Notice

Message: Undefined offset: 2

Filename: controllers/indent_receipt.php

Line Number: 71

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 3

Filename: controllers/indent_receipt.php

Line Number: 71

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 4

Filename: controllers/indent_receipt.php

Line Number: 71

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 5

Filename: controllers/indent_receipt.php

Line Number: 71

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: controllers/indent_receipt.php

Line Number: 71

thanks in advance.

1 Answer 1

1

Index is not exists. that why warning occurs

$a=array();
if(!empty($data['ids'][$i]))
$a = explode(",",$data['ids'][$i]);

Put above if condition it's working when index is not empty.

Sign up to request clarification or add additional context in comments.

1 Comment

How did you know which was line 71 ??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.