From 99a53fcfd4cc078eace40c84d72df27b8a44a8c4 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 16 Jun 2019 12:30:11 +0200 Subject: [PATCH] Remove fallback to ip column in network table as we removed this column in DB version 5. There will always be a corresponding entry for each device in the network table. Signed-off-by: DL6ER --- api_db.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/api_db.php b/api_db.php index 8342b914..547b3cb5 100644 --- a/api_db.php +++ b/api_db.php @@ -73,17 +73,12 @@ if(isset($_GET["network"]) && $auth) while($results !== false && $res = $results->fetchArray(SQLITE3_ASSOC)) { $id = $res["id"]; - // Backup IP column of this request in case we want to reuse it further down - $resip = $res["ip"]; // Empty array for holding the IP addresses $res["ip"] = array(); // Get IP addresses for this device - $ips = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); - while($ips !== false && $ip = $ips->fetchArray(SQLITE3_ASSOC)) + $network_addresses = $db->query("SELECT ip FROM network_addresses WHERE network_id = $id ORDER BY lastSeen DESC"); + while($network_addresses !== false && $ip = $network_addresses->fetchArray(SQLITE3_ASSOC)) array_push($res["ip"],$ip["ip"]); - // If the network_addresses table does not contain any IPs for this client, we use the IP stored in the network table - if(count($res["ip"]) < 1) - array_push($res["ip"],$resip); array_push($network, $res); }