From 83ef44f5e06fc3495d05bde70479e360e481353a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Sun, 15 May 2016 02:39:40 +0200 Subject: [PATCH] Add to table --- blomzt/main.php | 50 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/blomzt/main.php b/blomzt/main.php index f31d2f6..404f40a 100644 --- a/blomzt/main.php +++ b/blomzt/main.php @@ -1,17 +1,17 @@ Blomzt + + + + + - + + + +
+ + + +
+ @@ -33,8 +61,16 @@ if (!TableExists($config['db_table'], $conn)) { // Functions function TableExists($table, $conn) { - $res = mysqli_query($conn, 'SHOW TABLES LIKE \'$table\''); + $res = mysqli_query($conn, "SHOW TABLES LIKE '$table'"); return mysqli_num_rows($res) > 0; } +function addToTable($lon, $lat, $url, $table, $conn) { + $sql = "INSERT INTO `" . $table . "` (`id`, `location`, `url`, `date_added`) VALUES (NULL, GeomFromText('POINT(" . $lon . $lat . ")',4326), 'test', CURRENT_TIMESTAMP)"; + //$sql = mysqli_real_escape_string($conn, $sql); + printf($sql); + $res = mysqli_query($conn, $sql); + ($res) ? printf("true") : printf("false"); +} + ?> \ No newline at end of file