--- a/admin/importdatagov.php +++ b/admin/importdatagov.php @@ -59,7 +59,7 @@ //"t" mode string translates windows line breaks to unix $datamapping0712 = array( - "_id" => "", +// "_id" => "", "Agency Name" => "agencyName", "Parent Contract ID" => "parentCN", "Contract ID" => "CNID", @@ -130,7 +130,8 @@ $contractNoticeInsert[] = null; } } elseif (($datamapping0712[$headers[$c]]) == "amendDate" || ($datamapping0712[$headers[$c]]) == "publishDate" || ($datamapping0712[$headers[$c]]) == "contractStart" || ($datamapping0712[$headers[$c]]) == "contractEnd") { - $contractNoticeInsert[] = date('Y-m-d H:i:s', strtotime($data[$c])); +//echo $datamapping0712[$headers[$c]]." ".$data[$c]." ".date('Y-m-d H:i:s', strtotime(str_replace('/','-',$data[$c])))."\n"; + $contractNoticeInsert[] = date('Y-m-d H:i:s', strtotime(str_replace('/','-',$data[$c]))); } else { if (strstr("\" =", $data[$c] > 0)) { die("Invalid Description field" . $contractNoticeInsert); @@ -142,12 +143,14 @@ } } flush(); - //print_r($contractNoticeInsert); +// print_r($contractNoticeInsert); $contractNoticeInsertQ->execute($contractNoticeInsert); $errors = $conn->errorInfo(); if ($errors[1] == 7 && strpos($errors[2], "duplicate key")) { - // echo "dupe
"; - } elseif ($errors[1] == 0) { +// echo "dupe {$data[2]} row $row
\n"; + } else { + if ($errors[1] == 0) { + echo "success {$data[2]} row $row
\n"; $success++; } else { foreach ($contractNoticeFields as $key => $cnf) { @@ -155,7 +158,7 @@ } echo $data[2] . " failed CN insert.
" . print_r($errors, true) . "
row $row

\n"; } - +} flush(); //echo "
\n"; }