From d8e8eee5d67610393d6ac07ebdefb998addfdd95 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Wed, 15 Jun 2016 11:42:17 +1000 Subject: [PATCH] Fixed issue: Importing CSV with empty columns at end of file causing failure --- functions/functions.import.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/functions.import.php b/functions/functions.import.php index 83989f81..500bc08d 100644 --- a/functions/functions.import.php +++ b/functions/functions.import.php @@ -308,8 +308,11 @@ function import_file($file, $description, $fields, $firstrow = 2) * insert into sample_var field */ foreach($selected_name as $key => $val) - { - $dkey = $db->Quote($data[$key - 1]); + { + if (isset($data[$key -1 ])) + $dkey = $db->Quote($data[$key - 1]); + else + $dkey = $db->Quote(""); $sql = "INSERT INTO sample_var (sample_id,var_id,val) VALUES ('$sid','{$sirv_id[$key]}',{$dkey})";