query("SELECT temperature_id FROM temperature_log")->fetchAll(PDO::FETCH_COLUMN); foreach ($ids as $id) $readings[]=new TemperatureReading($id); return $readings; } public function GetRange(DateTime $from, DateTime $to) { $readings=array(); $prep=self::$PDO->prepare("SELECT temperature_id FROM temperature_log WHERE `timestamp`>=:from AND `timestamp`<=:to"); $prep->execute(array( ":from"=>$from->format('Y-m-d H:i:s'), ":to"=>$to->format('Y-m-d H:i:s') )); $results=$prep->fetchAll(PDO::FETCH_COLUMN); foreach ($results as $id) $readings[]=new TemperatureReading($id); return $readings; } }