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.
34 lines
906 B
34 lines
906 B
<?php
|
|
|
|
require_once('../BDD/SqliteDb.php');
|
|
require_once('../controleur/Controleur.php');
|
|
$db = new SqliteDb('o');
|
|
|
|
|
|
$reponseQuery = $db->prepare('SELECT count(*) FROM QcmQuestion');
|
|
$reponseResult = $reponseQuery->execute();
|
|
$reponseRow = $reponseResult->fetchArray();
|
|
$numQuestion = $reponseRow['count(*)'] + 1;
|
|
|
|
$reponses = array();
|
|
if(isset($_GET['modif'])){
|
|
$db->supprimerQCM ($numQuestion);
|
|
}
|
|
|
|
//die($_GET['rep1'].'-'.$_GET['rep2'].'-'.$_GET['rep3']);
|
|
if($_GET['rep1'] == 'true'){
|
|
$reponses[] = 1;
|
|
}
|
|
if($_GET['rep2'] == 'true'){
|
|
$reponses[] =2;
|
|
}
|
|
if($_GET['rep3'] == 'true'){
|
|
$reponses[] = 3;
|
|
}
|
|
$isAdd = $db->ajouterQCM($numQuestion,$_GET['consigne'],$_GET['choix1'],$_GET['choix2'],$_GET['choix3'],$reponses);
|
|
if(!$isAdd){
|
|
echo '<strong>ERREUR : le numéro de question existe déjà dans la bdd</strong>';
|
|
}
|
|
else echo '<strong>AJOUT QCM avec succès</strong>';
|
|
|