0

Hello everyone here i am having a problem Getting Undefined offset: 1, although array $row is having the values

 public function model(array $row)
    {      
        return new Result([
            'roll'=>$row[0], 
            'cname'=>$row[1], 
            'mname'=>$row[2], 
            'fname'=>$row[3], 
            'dob'=>$row[4], 
            'school_code'=>$row[5], 
            'h1'=>$row[6], 
            'h2'=>$row[7], 
            'e1'=>$row[8], 
            'e2'=>$row[9], 
            'sanskrit'=>$row[10], 
            'm1'=>$row[11], 
            'm2'=>$row[12], 
            's1'=>$row[13], 
            's2'=>$row[14], 
            's3'=>$row[15], 
            'sp'=>$row[16], 
            'sst1'=>$row[17], 
            'sst2'=>$row[18], 
            'result'=>$row[19], 
            'grace'=>$row[20], 
        ]);
    }

please help me out, i am trying excel file data to sql in laravel

  • may you show the content of $row? – AliHpanahi Jul 18 '21 at 06:58
  • yes i want to.. – Rajan Bharadwaj Jul 18 '21 at 07:55
  • @RajanBharadwaj: rest assured when PHP gives the undefined offset diagnostic message, it is what is. That sometimes surprises us as we were confident it should not be the case. But don't fear, this is just an error message and I've closed it against a reference of common errors we encounter when writing PHP code - as this is one of such errors. It has more information about the error itself, as well as on how to debug and deal with it. – hakre Jul 18 '21 at 08:21

0 Answers0