This question already has an answer here:
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP 28 answers
I'm continually getting the above error when importing data from csv using the following code:
$csv_data=file_get_contents("data3_received.csv");
foreach(preg_split("/((\r?\n)|(\r\n?))/", $csv_data) as $line){
list($service_id, $ki3) = explode(',', $line,2);
The data imports as expected but the error log is filling up as we utilise the same code in multiple php scripts. The error is on the following line:
list($service_id, $ki3) = explode(',', $line,2);
Tried using the suggestion here: Undefined offset error on php when importing a CSV to no avail, and other on the site.
Any help with this would be most welcome.