$id); } $select = $db->prepare("SELECT * FROM gates ".$where); if(!$select->execute($array)) error("Unable to read gates"); $gates = array(); while($gate = $select->fetch()) $gates[] = array("id" => intval($gate['id']), "name" => $gate['name'], "number" => $gate['number'], "address" => $gate['address'], "port" => intval($gate['port']), "lastSeen" => strtotime($gate['lastSeen'])); echo json_encode(array("timestamp" => time(), "gateTimeout" => $gateTimeout, "gates" => $gates)); ?>