$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'], "lastSeen" => intval(time())); echo json_encode(array("timestamp" => time(), "gateTimeout" => $gateTimeout, "gates" => $gates)); ?>