getPDO();
$stmt = $pdo->query("TRUNCATE `projet_prog_web`.`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)";
}