function getConducteurs($dateDeb, $dateFin) { $result = $this->db->execute("select conducteur, passager, date from `conducteur` where date>'{$dateDeb}' and date<'{$dateFin}' order by date"); $participants = array(); while (list($conducteur, $passager, $dateCovoiturage) = $result->fetch_row()) { if (!isset($currentDate)) { $currentDate = $dateCovoiturage; $participant = new participant($dateCovoiturage); } if ($currentDate != $dateCovoiturage) { array_push($participants, $participant); $participant = new participant($dateCovoiturage); } $participant->setConducteur($conducteur); $participant->addPassager($passager); $currentDate = $dateCovoiturage; } return $participants; }