diff options
| author | polo <ordipolo@gmx.fr> | 2022-11-25 03:59:32 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-11-25 03:59:32 +0100 |
| commit | efe371fd6e883dde99ca6d90a7aae99eb4aeadea (patch) | |
| tree | 54b342e58e4e3908abf5f42c85680d32540dd7f3 /php/Database.php | |
| download | AppliGestionPHP-efe371fd6e883dde99ca6d90a7aae99eb4aeadea.tar.gz AppliGestionPHP-efe371fd6e883dde99ca6d90a7aae99eb4aeadea.tar.bz2 AppliGestionPHP-efe371fd6e883dde99ca6d90a7aae99eb4aeadea.zip | |
première sauvegarde git
Diffstat (limited to 'php/Database.php')
| -rw-r--r-- | php/Database.php | 26 |
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 | ||
| 5 | try | ||
| 6 | { | ||
| 7 | $db = new PDO('sqlite:' . $db_name . '.sqlite'); | ||
| 8 | $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
| 9 | } | ||
| 10 | catch (Exception $e) | ||
| 11 | { | ||
| 12 | die('Erreur : '.$e->getMessage()); | ||
| 13 | } | ||
| 14 | |||
| 15 | |||
| 16 | // requêtes SQL | ||
| 17 | class 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 | } | ||
