$this->exec("INSERT INTO Demonstration VALUES('NBA',1,1,'Exemple de requête pour selectionner les 2 premières lignes de la table JOUEUR','SELECT * FROM JOUEUR WHERE rownum<3')");
$this->exec("INSERT INTO Demonstration VALUES('NBA',1,1,'Exemple de requête pour selectionner les 2 premières lignes de la table JOUEUR','SELECT * FROM JOUEUR WHERE rownum<3')");
$this->exec("INSERT INTO Demonstration VALUES('NBA',1,2,'Exemple de requête pour selectionner les 2 premières lignes de la table STATS','SELECT * FROM STATS WHERE rownum<3')");
$this->exec("INSERT INTO Demonstration VALUES('NBA',1,2,'Exemple de requête pour selectionner les 2 premières lignes de la table STATS','SELECT * FROM STATS WHERE rownum<3')");
$this->exec("INSERT INTO Demonstration VALUES('NBA',2,1,'Exemple de requête pour selectionner les 2 premières lignes de la table GAME','SELECT * FROM GAME WHERE rownum<3')");
}
}
function createQCM(){
function createQCM(){
@ -245,6 +245,50 @@ class SqliteDb extends SQLite3
return true;
return true;
}
}
function ajouterQCM($numQuestion,$consigne,$choix1,$choix2,$choix3,$numReponse){
$sqliteQuery = $db->prepare('UPDATE Demonstration SET numDemo=? WHERE numDemo=? AND chapitre=? ');
$sqliteQuery->bindParam(1, $j);
$sqliteQuery->bindParam(2, $iSuiv);
$sqliteQuery->bindParam(3, $_GET['numChapitre']);
$result = $sqliteQuery->execute();
echo 'lol';
}
}
else {
$numQuestionSuiv = $_GET['numQuestion']+1;
$sqliteQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion=? AND numTp = ?');
$sqliteQuery->bindParam(1, $_GET['numQuestion']);
$sqliteQuery->bindParam(2, $_GET['numTp']);
$result = $sqliteQuery->execute();
$typeRow = $result->fetchArray();
$sqliteQuery = $db->prepare('DELETE FROM Type WHERE numquestion= ? AND numTp=? ');
$sqliteQuery->bindParam(1, $_GET['numQuestion']);
$sqliteQuery = $db->prepare('SELECT type FROM Type WHERE numQuestion=? AND numTp = ?');
$sqliteQuery->bindParam(2, $_GET['numTp']);
$sqliteQuery->bindParam(1, $_GET['numQuestion']);
$result = $sqliteQuery->execute();
$sqliteQuery->bindParam(2, $_GET['numTp']);
$result = $sqliteQuery->execute();
$typeRow = $result->fetchArray();
$sqliteQuery = $db->prepare('DELETE FROM Type WHERE numquestion= ? AND numTp=? ');
$sqliteQuery->bindParam(1, $_GET['numQuestion']);
$sqliteQuery->bindParam(2, $_GET['numTp']);
$result = $sqliteQuery->execute();
if($typeRow['type'] == 'query'){
if($typeRow['type'] == 'query'){
$sqliteQuery = $db->prepare('SELECT count(*) FROM (SELECT numQuestion FROM Correct WHERE numTp=? UNION SELECT numQuestion FROM FunctionCorrect WHERE numTp=?)');
$sqliteQuery = $db->prepare('SELECT count(*) FROM (SELECT numQuestion FROM Correct WHERE numTp=? UNION SELECT numQuestion FROM FunctionCorrect WHERE numTp=?)');
$sqliteQuery->bindParam(1, $_GET['numTp']);
$sqliteQuery->bindParam(1, $_GET['numTp']);
$sqliteQuery->bindParam(2, $_GET['numTp']);
$sqliteQuery->bindParam(2, $_GET['numTp']);
@ -63,8 +91,8 @@ if($typeRow['type'] == 'query'){
$sqliteQuery->bindParam(3, $_GET['numTp']);
$sqliteQuery->bindParam(3, $_GET['numTp']);
$result = $sqliteQuery->execute();
$result = $sqliteQuery->execute();
}
}
}
}
else {
else {
$sqliteQuery = $db->prepare('SELECT count(*) FROM (SELECT numQuestion FROM Correct WHERE numTp=? UNION SELECT numQuestion FROM FunctionCorrect WHERE numTp=?)');
$sqliteQuery = $db->prepare('SELECT count(*) FROM (SELECT numQuestion FROM Correct WHERE numTp=? UNION SELECT numQuestion FROM FunctionCorrect WHERE numTp=?)');