From 3b60f34ebdde743149283f903e609c69d1ba26b5 Mon Sep 17 00:00:00 2001 From: krzysiej Date: Tue, 18 Jul 2017 11:54:52 +0200 Subject: [PATCH] Improved index.php a bit and added a clean version of database file. --- geo-empty.db | Bin 0 -> 3072 bytes index.php | 12 +----------- 2 files changed, 1 insertion(+), 11 deletions(-) create mode 100644 geo-empty.db diff --git a/geo-empty.db b/geo-empty.db new file mode 100644 index 0000000000000000000000000000000000000000..39717d3d66120a9c22f9b833a67650c598f9e096 GIT binary patch literal 3072 zcmWFz^vNtqRY=P(%1ta$FlJz3U}R))P*7lCV2B4|W*~+EULb=7#sSidNNilpcm~~P z>>!OyOz#+&9e~6r7!82|3xNP8HgRoj#>kSyq@2{^!W>}Ik1tLwEKSWzM&~j+2e~?i zxGID=I{CONpsCf!OUzBx0qWFjv}I%$mz8B~@&%ijlb@Vel9`_eqnS`lQGy98DQIwU zCS;~0aC-WMxVpOrDFg(0`Z@+hDtNm_DmaFQ_Ba08UmvsK<^L$ e<$p%zPYggb3PwXquery('SELECT * FROM location ORDER BY cre_dt DESC'); $rows = []; while ($row = $results->fetchArray(SQLITE3_ASSOC)) { @@ -25,8 +25,6 @@ switch ($action) { break; case 'delete': - $db = new SQLite3('geo.db'); - $stmt = $db->prepare('DELETE FROM location WHERE id = :id'); $stmt->bindValue(':id', $parameter, SQLITE3_INTEGER); $entry = $stmt->execute(); @@ -34,8 +32,6 @@ switch ($action) { break; case 'edit': - - $db = new SQLite3('geo.db'); $stmt = $db->prepare('SELECT * FROM location WHERE id = :id'); $stmt->bindValue(':id', $parameter, SQLITE3_INTEGER); $entry = $stmt->execute(); @@ -43,9 +39,6 @@ switch ($action) { include 'templates/edit.php'; break; case 'save': - - $db = new SQLite3('geo.db'); - //edycja if (isset($parameter) && !is_null($parameter) && (int)$parameter > 0) { $stmt = $db->prepare('UPDATE location SET title=:title, description=:description, dl=:dl, szer=:szer, up_dt=:up_dt WHERE id=:id'); @@ -70,15 +63,12 @@ switch ($action) { break; case 'mapa': - $db = new SQLite3('geo.db'); $results = $db->query('SELECT * FROM location ORDER BY cre_dt DESC'); $rows = []; while ($row = $results->fetchArray(SQLITE3_ASSOC)) { $rows[] = $row; } - include 'templates/mapa.php'; - break; default: include 'templates/main.php';