1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <?php
function getConnexion()
{
try {
$db = new PDO('sqlite:limsmetik_produit.sqlite',NULL,NULL,array(PDO::ATTR_PERSISTENT => true));
$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
return $db;
} catch (Exception $e) {
die("Erreur lors de la connexion à la BD");
}
}
function executeSQL($sql)
{
$db = getConnexion();
return $db->exec($sql);
}
function execute_SQL_Fetch($sql)
{
$db = getConnexion();
return $db->query($sql)->fetch();
}
function execute_SQL_FetchAll($sql)
{
$db = getConnexion();
return $db->query($sql)->fetchAll();
}
?> |
Partager