From 5898923e73b665ea0d69bc0226aa5ab2ae25636f Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 13 Dec 2021 10:00:20 -0700 Subject: [PATCH] Replace counting the array with adding a count inside the array. --- app/contacts/contact_import.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index c4721d166d..911033d448 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -319,10 +319,15 @@ //echo "field_name: $field_name
\n"; //add fields to the stack - $stack[$table_name][$field_name][] = null; + if (isset($field_count[$table_name][$field_name])) { + $field_count[$table_name][$field_name]++; + } + else { + $field_count[$table_name][$field_name] = 0; + } //set the ordinal ID - $id = count($stack[$table_name][$field_name]) - 1; + $id = $field_count[$table_name][$field_name]; //get the parent table name $parent = get_parent($schema, $table_name); @@ -374,7 +379,7 @@ } //debug information - //view_array($stack); + //view_array($field_count); //process a chunk of the array if ($row_id === 1000) { @@ -392,12 +397,15 @@ } } //if ($from_row <= $row_number) - unset($stack); + unset($field_count); $row_number++; $row_id++; } //end while fclose($handle); + //debug information + //view_array($array); + //save to the data if (is_array($array)) { $database = new database;