X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=includes%2Fformsearch.php;h=3c6e0ea3f1ce224ff39421be44b1025a88c4ddad;hb=a0e7c679474abba8e61aa6241f7a5293ab631cc1;hp=951bef1e546da3e6f311a6a8c32638fcdb818ea0;hpb=33eb6f2ab954597a257e9eb8f793a9bc52dd9524;p=Project_webapp.git diff --git a/includes/formsearch.php b/includes/formsearch.php index 951bef1..3c6e0ea 100644 --- a/includes/formsearch.php +++ b/includes/formsearch.php @@ -1,10 +1,10 @@ "; $input_failure = true; } +if (empty($form_arrival_date)) { + // Limit to a 6 months interval from the departure date. + $oArrivalDate = $oDepartureDate; + $oArrivalDate->add(new DateInterval("P6M")); + $form_arrival_date = $oArrivalDate->format('Y-m-d\TH:i'); +} + ?> -
Numéro de vol | \n"; - echo "Ville de départ | \n"; - echo "Date de départ | \n"; - echo "Ville d'arrivée | \n"; - echo "Date d'arrivée | \n"; - echo "Classe | \n"; - echo "Prix d'une place | \n"; - echo "Réserver | \n"; - echo "||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
" . $row['NumVol'] . " | \n"; - echo "" . $row['VilleD'] . " | \n"; - echo "" . $row['DateD'] . " | \n"; - echo "" . $row['VilleA'] . " | \n"; - echo "" . $row['DateA'] . " | \n"; - echo "" . $row['Classe'] . " | \n"; - echo "" . $row['Prix'] . "€ | \n"; - echo "
+ global $connection;
+ $sql_pquery = "select VOLS.NumVol as NumVol, VilleD, DateD, VilleA, DateA, Classe, round(CoutVol*CoeffPrix, 2) as Prix, NumAv
+ from VOLS, DEFCLASSES
+ where DEFCLASSES.NumVol = VOLS.NumVol and
+ DateD >= ? and VilleD = ? and DateA <= ? and VilleA = ?
+ order by DateD, NumVol, Prix";
+ $connection->prepare_query($sql_pquery);
+ $connection->prepared_query_bind_param("ssss", array($form_departure_date, $form_departure_city, $form_arrival_date, $form_arrival_city));
+ $connection->run_prepared_query();
+ $connection->get_pquery_result();
+ $rows = $connection->get_result_array();
+ $connection->close_prepared_query();
+ //FIXME: Use NumAv to see if a flight is fully booked.
+ //var_dump($rows);
+ if (empty($rows)) {
+ echo "Aucun vol ne correspond aux critères de recherche. "; + } else { + if ($action === "return_flight" && isset($_SESSION['return_flight_nb_place'])) { + $nb_places = $_SESSION['return_flight_nb_place']; + unset($_SESSION['return_flight_nb_place']); + } else { + $nb_places = 1; + } + echo "
| \n";
+ echo "