load(); if (($handle = fopen("2021-09-15-theses.csv", "r")) !== FALSE) { $pdo_obj = new conf(); $pdo = $pdo_obj->getPDO(); $stmt = $pdo->query("TRUNCATE `" . getenv('DBNAME') ."`.`theses`"); $row = 1; $new_these = these::emptyThese(); while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) { $num = count($data); if ($row > 1) { for ($c = 0 ; $c < $num ; $c++) { $new_these->insertField($data[$c], $c); } $dump = new dump($new_these); try { $dump->sendThese(); } catch (Exception) { echo "

Failed on (" . $row .") :
"; var_dump($new_these); } } $row++; } fclose($handle); echo "

CSV file imported into DB. (" . $row . " results)"; }