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