X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fformsearch.php;h=5cdca0cc4322af26d8bfe9402bc0d26a009aa11f;hb=181c3ee47dbbd650216b0e39d6539dc2c6d2b811;hp=6bd0fa1850372714c2224ecda11385873441e8fd;hpb=f38123a5d3eafd9af6fb25e1dd5ccf29c5508b36;p=Project_webapp.git
diff --git a/includes/formsearch.php b/includes/formsearch.php
index 6bd0fa1..5cdca0c 100644
--- a/includes/formsearch.php
+++ b/includes/formsearch.php
@@ -99,21 +99,27 @@ if (empty($form_arrival_date)) {
= ? and VilleD = ? and DateA <= ? and VilleA = ?
+ $sql_pquery = "select VOLS.NumVol as NumVol, VilleD, DateD, VilleA, DateA, DEFCLASSES.Classe, round(CoutVol*CoeffPrix, 2) as Prix, CapAv
+ from VOLS join DEFCLASSES on DEFCLASSES.NumVol = VOLS.NumVol
+ join AVIONS on AVIONS.NumAv = VOLS.NumAv
+ where 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();
+ $fligths = $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)) {
+ //var_dump($fligths);
+ if (empty($fligths)) {
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 "
Numéro de vol | \n"; @@ -125,28 +131,47 @@ if (!$input_failure) { 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 "" . $fligth['NumVol'] . " | \n"; + echo "" . $fligth['VilleD'] . " | \n"; + echo "" . $fligth['DateD'] . " | \n"; + echo "" . $fligth['VilleA'] . " | \n"; + echo "" . $fligth['DateA'] . " | \n"; + echo "" . $fligth['Classe'] . " | \n"; + echo "" . $fligth['Prix'] . "€ | \n"; echo "+ Nombre de places libres : " . $free_places . " | \n"; echo "