🎨 Little code cleaning

This commit is contained in:
Florian Sylvain
2022-01-07 18:22:44 +01:00
parent 131a466b17
commit 64e70c6c5c
2 changed files with 14 additions and 9 deletions
+2 -1
View File
@@ -179,7 +179,8 @@ function displayResults(results, aCount) {
let pre_replacement = new RegExp(searchString, 'gi').exec(e)
child.innerHTML = e.replace(pre_replacement, `<mark>${pre_replacement}</mark>`)
content.appendChild(child)
} i += 1
}
i += 1
})
header.addEventListener('click', () => {
+6 -2
View File
@@ -9,9 +9,12 @@ require_once('../class/dotEnv.php');
if (($handle = fopen(getenv('FILE'), "r")) !== FALSE) {
$dbname = getenv('DBNAME');
$pdo_obj = new conf();
$pdo = $pdo_obj->getPDO();
$stmt = $pdo->query("TRUNCATE `" . getenv('DBNAME') ."`.`theses`");
$stmt = $pdo->prepare("TRUNCATE `:dbname`.`theses`");
$stmt->bindParam(':dbname', $dbname);
$row = 1;
while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
@@ -27,7 +30,8 @@ if (($handle = fopen(getenv('FILE'), "r")) !== FALSE) {
} catch (Exception $e) {
echo "<br><br>Failed on " . $row . " ( " . $e->getMessage() . " ) :<br>";
}
} $row++;
}
$row++;
}
fclose($handle);
echo "<br><br>CSV file imported into DB. (" . $row . " results)";