Brendan Abolivier 9 years ago
parent
commit
4b2c67cbb1

+ 1
- 1
web/model/class.connector.php View File

@@ -11,7 +11,7 @@ class Connector {
11 11
 		$pass = "chabat";
12 12
 
13 13
 		$this->bdd = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
14
-		$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
14
+		$this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
15 15
 	}
16 16
 
17 17
 	/*

+ 1
- 1
web/model/class.question.php View File

@@ -8,7 +8,7 @@ class Question {
8 8
 
9 9
 	function __construct($intitule) {
10 10
 		try{
11
-			$this->intitule;
11
+			$this->intitule = $intitule;
12 12
 
13 13
 			$bdd = new Connector();
14 14
 

+ 7
- 6
web/model/class.questset.php View File

@@ -8,16 +8,16 @@ class Questset {
8 8
 
9 9
 	function __construct($reponses) {
10 10
 		if(is_array($reponses)) {
11
-			$this->intitules = array();
12
-			$this->reponse1 = $reponse[0];
13
-			$this->reponse2 = $reponse[1];
11
+			$this->questions = array();
12
+			$this->reponse1 = $reponses[0];
13
+			$this->reponse2 = $reponses[1];
14 14
 			try {
15 15
 				$bdd = new Connector();
16 16
 
17 17
 				$options = array(
18 18
 					"where" => array(
19
-						array("reponse1", "=", $reponse1),
20
-						array("reponse2", "=", $reponse2)
19
+						array("reponse1", "=", $this->reponse1),
20
+						array("reponse2", "=", $this->reponse2)
21 21
 					)
22 22
 				);
23 23
 
@@ -27,10 +27,11 @@ class Questset {
27 27
 					array_push($this->questions, new Question($question['intitule']));
28 28
 				}
29 29
 
30
-				$this->categorie = $bdd->Select('*', 'reponses', $options)['nom_cat'];
30
+				$this->categorie = $bdd->Select('*', 'reponses', $options)[0]['nom_cat'];
31 31
 			} catch(Exception $e) {
32 32
 				throw $e;
33 33
 			}
34
+			echo "Initialized\n";
34 35
 		} else {
35 36
 			throw new Exception('Un tableau de réponses est attendu dans le constructeur.');
36 37
 		}

+ 1
- 1
web/model/classes.php View File

@@ -2,5 +2,5 @@
2 2
 
3 3
 // Call this file from the root folder
4 4
 require_once('model/class.connector.php');
5
-require_once('model/class.questions.php');
5
+require_once('model/class.question.php');
6 6
 require_once('model/class.questset.php');