|
@@ -12,16 +12,34 @@ if (isset($_POST["csv"])) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// On enregistre les data dans la BDD
|
|
// On enregistre les data dans la BDD
|
|
|
- $sql = "INSERT INTO notes_rang(annee, note, classement) VALUE (:annee, :note, :classement)";
|
|
|
|
|
|
|
+ // MySQL avec autoImcrement
|
|
|
|
|
+ $sql = "INSERT INTO notes_rang(annee, note, classement) VALUES (:annee, :note, :classement)";
|
|
|
$reqInsertRangLimites = $db->prepare($sql);
|
|
$reqInsertRangLimites = $db->prepare($sql);
|
|
|
|
|
|
|
|
foreach ($csvArray as $item) {
|
|
foreach ($csvArray as $item) {
|
|
|
$reqInsertRangLimites->execute([
|
|
$reqInsertRangLimites->execute([
|
|
|
- "annee" => $item[1],
|
|
|
|
|
- "note" => $item[3],
|
|
|
|
|
- "classement" => $item[2]
|
|
|
|
|
|
|
+ "annee" => (int) $item[1],
|
|
|
|
|
+ "note" => (float) $item[3],
|
|
|
|
|
+ "classement" => (int) $item[2]
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // PgSQL sans autoIncrement
|
|
|
|
|
+ /*
|
|
|
|
|
+ $sql = "INSERT INTO notes_rang(id, annee, note, classement) VALUES (:id, :annee, :note, :classement)";
|
|
|
|
|
+ $reqInsertRangLimites = $db->prepare($sql);
|
|
|
|
|
+
|
|
|
|
|
+ $initialId = 14701;
|
|
|
|
|
+ foreach ($csvArray as $item) {
|
|
|
|
|
+ $initialId ++;
|
|
|
|
|
+ $reqInsertRangLimites->execute([
|
|
|
|
|
+ "id" => $initialId,
|
|
|
|
|
+ "annee" => (int) $item[1],
|
|
|
|
|
+ "note" => (float) $item[3],
|
|
|
|
|
+ "classement" => (int) $item[2]
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
echo "Valeurs enregistrées";
|
|
echo "Valeurs enregistrées";
|
|
|
|
|
|