From 492b4ba3f22d0f30876f2c5b82ea2ae94423cabf Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 26 Mar 2021 20:21:38 +0100 Subject: [PATCH] =?UTF-8?q?petites=20am=C3=A9liorations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/db.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/db.class.php b/include/db.class.php index 568c0ce..4917ef4 100644 --- a/include/db.class.php +++ b/include/db.class.php @@ -113,11 +113,11 @@ class db function getCurrentPlanes() { - $query = "SELECT UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW() AND public='1'"; + $query = "SELECT idAvion as uid, UNIX_TIMESTAMP(deliveryTime) as deliveryTime, deliveryTZ, destLat, destLon, destName, UNIX_TIMESTAMP(startTime) as startTime, startTZ, startLon, startLat, startName, color FROM avionpoeme WHERE deliveryTimeServer>NOW() AND public='1'"; $this->query($query); $planes = $this->result->fetch_all(MYSQLI_ASSOC); - print json_encode($planes); + return planes; } function getAnthology($page=0) @@ -129,13 +129,15 @@ class db if ($page <= 0) //renvoie le nombre de ligne d'anthologie { print '{"nAnthology":"' . $result["count"] . '","nPages":"' . $n_pages .'"}'; + return $n_pages; }else //renvoie les lignes d'anthologie { if ($page > $n_pages) $page=$n_pages; - $query = "SELECT deliveryTime, deliveryTZ, destName, startTime, startTZ, startName, message FROM avionpoeme WHERE public='1' LIMIT " . ($page-1)*RESULTS_BY_PAGE . "," . RESULTS_BY_PAGE; + $query = "SELECT deliveryTime, deliveryTZ, destName, startTime, startTZ, startName, message FROM avionpoeme WHERE public='1' LIMIT " . ($page-1)*RESULTS_BY_PAGE . "," . RESULTS_BY_PAGE . " ORDER BY startTime ASC"; $this->query($query); $planes = $this->result->fetch_all(MYSQLI_ASSOC); print json_encode($planes, JSON_FORCE_OBJECT); + return $planes; } }