8d6a2feb |
<?php
class Bdd
{
public $bdd;
|
74c94f79 |
public function __construct($bdd = 'fiches3')
|
8d6a2feb |
{
|
3957c7ee |
switch($bdd) {
|
74c94f79 |
case 'fiches3':
$this->bdd = new PDO(DSN_FICHES, USER_FICHES, PASS_FICHES);
|
3957c7ee |
break;
|
74c94f79 |
case 'abitop':
$this->bdd = new PDO(DSN_ABITOP, USER_ABITOP, PASS_ABITOP);
|
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;
}
}
|