Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined index: code
#1

[eluser]Unknown[/eluser]
Hello,

I have an import file, with wich I want to import some from a file into a database. When I call the file I get this errors


Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: code

Filename: controllers/import.php

Line Number: 217


A PHP Error was encountered

Severity: Notice

Message: Undefined index: id_producator

Filename: controllers/import.php

Line Number: 237


A PHP Error was encountered

Severity: Notice

Message: Undefined index: code

Filename: controllers/import.php

Line Number: 513

the cod from those lines is this

line 217

Code:
$chars=array(' ','/','.','-','(',')',"'", '"');

    $articol=str_replace($chars,'',str_replace('_','',$field['code']));

line 237

Code:
$this->db->select('A.ART_ID');

    $this->db->from('tof_articles AS A');

    $this->db->where('AVT_NR',$articol);

     if ($this->input->post('producator') && $this->input->post('producator') != 0 && $this->input->post('producator') != -1){

     $this->db->where('A.ART_SUP_ID',$this->input->post('producator'));

     }

     if ($this->input->post('producator') && $this->input->post('producator') == -1){

[color=red]     $this->db->where('A.ART_SUP_ID',$field['id_producator']);[/color]

     }

    $query=$this->db->get();


line 513

Code:
if($query->num_rows() > 1){

      $data['esuate_mare'][]=str_replace('_','',$field['code']).' -> ';

     } else {

      [color=red]$data['esuate_mic'][]=str_replace('_','',$field['code']).' -> ';[/color]

     }
#2

[eluser]painkiller[/eluser]
Check that your variable $field is properly set. The error means that there is no such key "code" in your $field.
#3

[eluser]TheFuzzy0ne[/eluser]
Try doing something like:
Code:
die(print_r($field, TRUE));

That should allow you to see what is and isn't in your array.




Theme © iAndrew 2016 - Forum software by © MyBB