diff --git a/blomzt/main.php b/blomzt/main.php index 8fd6ffe..ed8e321 100644 --- a/blomzt/main.php +++ b/blomzt/main.php @@ -53,6 +53,12 @@ if (!TableExists($config["db_table"], $conn)) { + + @@ -70,9 +76,25 @@ function addToTable($lat, $lon, $url, $table, $conn) { settype($lon, "double"); $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); + //printf($sql); $res = mysqli_query($conn, $sql); ($res) ? printf("true") : printf("false"); } +function getList($conn, $table) { + + $sql = "SELECT * FROM `$table`;"; + print_r($sql); + $res = mysqli_query($conn, $sql); + ($res) ? printf("true") : printf("false"); + + $list = array(); + + while($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) { + $list[] = $row; + } + + return $list; +} + ?> \ No newline at end of file