8d6a2feb |
<?php
|
daf6e125 |
namespace MVC\Classe;
|
8d6a2feb |
class Bdd
{
public $bdd;
|
6602a9e3 |
public function __construct($bdd = 'bdd1')
|
8d6a2feb |
{
|
3957c7ee |
switch($bdd) {
|
6602a9e3 |
case 'bdd1':
$this->bdd = new PDO(DSN_BDD1, USER_BDD1, PASS_BDD1);
|
3957c7ee |
break;
|
6602a9e3 |
case 'bdd2':
$this->bdd = new PDO(DSN_BDD2, USER_BDD2, PASS_BDD2);
|
3957c7ee |
break;
default:
$this->bdd = new PDO(DSN_FICHES, USER_FICHES, PASS_FICHES);
}
|
8d6a2feb |
}
public function faireUneRequete($sql)
{
$req = $this->bdd->query($sql, PDO::FETCH_ASSOC);
return $req;
}
public function creerTableau($res){
$tab = array();
foreach($res as $key => $row){
$tab[$key] = $row;
}
return $tab;
}
}
|