SAND-framework/application/class/Bdd.php
Emmanuel ROY 326ef5ab59 repositionnement du bin.php pour les commandes
ajout de pages sur le template polo (docs,about,cgu)
modification du fichier de bdd
2020-12-08 08:47:44 +01:00

41 lines
986 B
PHP

<?php
namespace MVC\Classe;
class Bdd
{
public $bdd;
public function __construct($bdd = 'bdd1')
{
switch($bdd) {
case 'bdd1':
$this->bdd = new PDO(DSN_BDD1, USER_BDD1, PASS_BDD1);
break;
case 'bdd2':
$this->bdd = new PDO(DSN_BDD2, USER_BDD2, PASS_BDD2);
break;
default:
$this->bdd = new PDO(DSN_BDD_DEFAULT, USER_BDD_DEFAULT, PASS_BDD_DEFAULT);
}
}
public function faireUneRequete($sql)
{
$req = $this->bdd->query($sql, PDO::FETCH_ASSOC);
return $req;
}
public function exploiterResultat($res){
foreach($res as $data) {
foreach ($data as $key => $row) {
if (is_string($row)) {
$row = Caracter::normalise_ChaineDeCaracteresDownload($row);
}
$data[$key] = $row;
}
}
return $res;
}
}