You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
<?php
|
|
|
|
require_once('../BDD/SqliteDb.php');
|
|
require_once('../controleur/Controleur.php');
|
|
|
|
|
|
$db = new SqliteDb('o');
|
|
|
|
|
|
if (empty($_GET['chapitre']) || empty($_GET['bdd']) || empty($_GET['description']) || empty($_GET['reponse']) ) {
|
|
echo '<strong>ERREUR : Veuillez remplir tous les champs </strong>';
|
|
}
|
|
|
|
else if(!is_numeric($_GET['chapitre']))
|
|
echo '<strong>ERREUR : une valeur non numérique à été détectée dans le champ \'Chapitre n° :\' </strong>';
|
|
|
|
else {
|
|
$reponseQuery = $db->prepare('SELECT count(*) FROM demonstration WHERE chapitre=?');
|
|
$reponseQuery->bindParam(1, $_GET['chapitre']);
|
|
$reponseResult = $reponseQuery->execute();
|
|
$reponseRow = $reponseResult->fetchArray();
|
|
$numDemo = $reponseRow['count(*)'] + 1;
|
|
|
|
if(isset($_GET['modif'])){
|
|
$db->supprimerDemonstration($_GET['chapitre'], $numDemo);
|
|
}
|
|
|
|
|
|
$isAdd = $db->ajouterDemonstration($_GET['bdd'],$_GET['chapitre'],$numDemo,$_GET['description'], $_GET['reponse']);
|
|
if(!$isAdd){
|
|
echo '<strong>ERREUR : la combinaison (numéro de chapitre, numéro de démonstration) existe déjà dans la bdd</strong>';
|
|
}
|
|
else echo '<strong>AJOUT Démonstration avec succès</strong>';
|
|
|
|
|
|
|
|
|
|
}
|
|
//require_once('index.php');
|
|
//header("Location: ../index.php");
|
|
|