summaryrefslogtreecommitdiff
path: root/php/Database.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/Database.php')
-rw-r--r--php/Database.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/php/Database.php b/php/Database.php
new file mode 100644
index 0000000..81ce669
--- /dev/null
+++ b/php/Database.php
@@ -0,0 +1,26 @@
1<?php
2// php/Database.php
3
4// connexion avec PDO_sqlite
5try
6{
7 $db = new PDO('sqlite:' . $db_name . '.sqlite');
8 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
9}
10catch (Exception $e)
11{
12 die('Erreur : '.$e->getMessage());
13}
14
15
16// requêtes SQL
17class SQL
18{
19 // créer les tables si elles n'existent pas encore
20 static function create_tables()
21 {
22 //$db->exec("CREATE TABLE IF NOT EXISTS matable (ID INTEGER PRIMARY KEY, champ1 INTEGER, champ2 TEXT);");
23 //
24 //
25 }
26}