<?php

require_once('../BDD/SqliteDb.php');
$db = new SqliteDb('o');


$numQuestion = $_GET['numDemo'];
$numTp = $_GET['numChapitre'];
$numQuestionPrec = $numQuestion-1;
$test = 999;

if(isset($_GET['des'])){
    $numQuestion += 1;
    $numQuestionPrec = $numQuestion-1;
}

if($numQuestion!=1){
          
    $sqliteQuery = $db->prepare('UPDATE Demonstration SET numDemo=? WHERE numDemo=? AND chapitre=?');   
    $sqliteQuery->bindParam(1, $test);
    $sqliteQuery->bindParam(2, $numQuestion);
    $sqliteQuery->bindParam(3, $numTp);
    $result = $sqliteQuery->execute();
   
    
    $sqliteQuery = $db->prepare('UPDATE Demonstration SET numDemo=? WHERE numDemo=? AND chapitre=?');
    $sqliteQuery->bindParam(1, $numQuestion);
    $sqliteQuery->bindParam(2, $numQuestionPrec);
    $sqliteQuery->bindParam(3, $numTp);
    $resulti = $sqliteQuery->execute();

    
    $sqliteQuery = $db->prepare('UPDATE Demonstration SET numDemo=? WHERE numDemo=? AND chapitre=?');
    $sqliteQuery->bindParam(1, $numQuestionPrec);
    $sqliteQuery->bindParam(2, $test);
    $sqliteQuery->bindParam(3, $numTp);
    $resultp = $sqliteQuery->execute();
    
    
    
}
 
//header("Location: index.php");


