if (trim($tempLine) != '') { $i++; } } fclose($handle); } $_SESSION['csvEstimatedRecords'] = $i - $csvIgnoreNRows - ($csvFieldNamesOnTop ? 1 : 0); } // header ?> <h1>Importing CSV data ...</h1> <div style="width: 700px; text-align: left;"> <?php // get tablename and csv data $tn = $_POST['tableName']; $arrCSVData = getCSVArray($csvStart); echo 'Starting at record ' . number_format($csvStart) . ' of ' . number_format($_SESSION['csvEstimatedRecords']) . ' total estimated records ...<br />'; if (@count($arrCSVData) > 1) { // backup table if ($_POST['csvBackupBeforeImport']) { if (sqlValue("select count(1) from `{$tn}`")) { $btn = $tn . '_backup_' . @date('YmdHis'); sql("drop table if exists `{$btn}`"); sql("create table if not exists `{$btn}` select * from `{$tn}`"); echo "Table '{$tn}' backed up as '{$btn}'.<br /><br />"; } else { echo "Table '{$tn}' is empty, so no backup was done.<br /><br />"; } } // field list $fieldList = '`' . implode('`,`', noSpaces($arrCSVData[0])) . '`';
if (trim($tempLine) != '') { $i++; } } fclose($handle); } $_SESSION['csvEstimatedRecords'] = $i - $csvIgnoreNRows - ($csvFieldNamesOnTop ? 1 : 0); } // header ?> <div class="page-header"><h1>Importing CSV data ...</h1></div> <div style="width: 700px; text-align: left;"> <?php // get tablename and csv data $tn = $_POST['tableName']; $arrCSVData = getCSVArray($csvStart, 0, false); echo 'Starting at record ' . number_format($csvStart) . ' of ' . number_format($_SESSION['csvEstimatedRecords']) . ' total estimated records ...<br>'; if (@count($arrCSVData) > 1) { // backup table if ($_POST['csvBackupBeforeImport']) { if (sqlValue("select count(1) from `{$tn}`")) { $btn = $tn . '_backup_' . @date('YmdHis'); sql("drop table if exists `{$btn}`", $eo); sql("create table if not exists `{$btn}` select * from `{$tn}`", $eo); echo "Table '{$tn}' backed up as '{$btn}'.<br><br>"; } else { echo "Table '{$tn}' is empty, so no backup was done.<br><br>"; } } // field list $fieldList = '`' . implode('`,`', noSpaces($arrCSVData[0])) . '`';