Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

initial commmit de la branche Nude with composer

git authored on 14/03/2019 16:48:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,37 @@
1
+<?php
2
+
3
+namespace MVC\Classe;
4
+
5
+class Bdd
6
+{
7
+    public $bdd;
8
+
9
+    public function __construct($bdd = 'bdd1')
10
+    {
11
+        switch($bdd) {
12
+            case 'bdd1':
13
+                $this->bdd = new PDO(DSN_BDD1, USER_BDD1, PASS_BDD1);
14
+            break;
15
+            case 'bdd2':
16
+                $this->bdd = new PDO(DSN_BDD2, USER_BDD2, PASS_BDD2);
17
+            break;
18
+            default:
19
+                $this->bdd = new PDO(DSN_FICHES, USER_FICHES, PASS_FICHES);
20
+        }
21
+    }
22
+
23
+    public function faireUneRequete($sql)
24
+    {
25
+        $req = $this->bdd->query($sql, PDO::FETCH_ASSOC);
26
+        return $req;
27
+    }
28
+
29
+    public function creerTableau($res){
30
+
31
+        $tab = array();
32
+        foreach($res as $key => $row){
33
+            $tab[$key] = $row;
34
+        }
35
+        return $tab;
36
+    }
37
+}
0 38
\ No newline at end of file