php - "Notice: Undefined index" on some values when pushing to array -


i adding values keys array:

public function adddata($key, $value){     $this->data[$key] =  $value; }  //this line y in class $dataholder->adddata($fieldnames[$i], $row{$fieldnames[$i]}); 

it works of time.

notice: undefined index [keyvalue] in x.php in line y 

the array empty , values , keys database table.

most of fields inserted without problem, gives error? ideas on why works sometimes?

delcare $this->data = array(); above function

or

it might happen when key or value passing empty value function database.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -