1
0

petites améliorations

This commit is contained in:
Daniel Tartavel 2021-03-26 20:21:38 +01:00
parent 6dbf315f9f
commit 492b4ba3f2

View File

@ -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;
}
}