forked from tom.biard/ScienceQuest
parent
b9475e1fcb
commit
9d70e4cead
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
//gen
|
||||||
|
$rep=__DIR__.'/../';
|
||||||
|
|
||||||
|
// liste des modules à inclure
|
||||||
|
|
||||||
|
//$dConfig['includes']= array('controleur/Validation.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//BD
|
||||||
|
|
||||||
|
$dsn="sasa";
|
||||||
|
$login="";
|
||||||
|
$mdp="";
|
||||||
|
|
||||||
|
//Vues
|
||||||
|
|
||||||
|
$vues['index']='vues/index.php';
|
||||||
|
|
||||||
|
?>
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
class Connection extends PDO {
|
||||||
|
|
||||||
|
private $stmt;
|
||||||
|
|
||||||
|
public function __construct(string $dsn, string $username, string $password) {
|
||||||
|
|
||||||
|
parent::__construct($dsn,$username,$password);
|
||||||
|
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** * @param string $query
|
||||||
|
* @param array $parameters *
|
||||||
|
* @return bool Returns `true` on success, `false` otherwise
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function executeQuery(string $query, array $parameters = []) : bool{
|
||||||
|
$this->stmt = parent::prepare($query);
|
||||||
|
foreach ($parameters as $name => $value) {
|
||||||
|
$this->stmt->bindValue($name, $value[0], $value[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResults() : array {
|
||||||
|
return $this->stmt->fetchall();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in new issue