X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=includes%2Fformsearch.php;h=dc682dafb80803829b58db91d0d27805ab9853e2;hb=e14003dc40dec3eb928a58cdff78fddd31990907;hp=cd12ee4a5b988b8aff76f592022ed64c1f77cd3e;hpb=68cee0ac3fe728566e16dc0460416c77022f4b22;p=Project_webapp.git
diff --git a/includes/formsearch.php b/includes/formsearch.php
index cd12ee4..dc682da 100644
--- a/includes/formsearch.php
+++ b/includes/formsearch.php
@@ -108,10 +108,10 @@ if (!$input_failure) {
$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();
- $fligths = $connection->get_result_array();
+ $flights = $connection->get_result_array();
$connection->close_prepared_query();
- //var_dump($fligths);
- if (empty($fligths)) {
+ //var_dump($flights);
+ if (empty($flights)) {
echo "Aucun vol ne correspond aux critères de recherche.
";
} else {
if ($action === "return_flight" && isset($_SESSION['return_flight_nb_place'])) {
@@ -131,10 +131,10 @@ if (!$input_failure) {
echo "
Prix d'une place | \n";
echo " Réserver | \n";
echo " \n";
- foreach ($fligths as $fligth) {
- $sql_pquery = "select sum(NbPlaces) from RESERVATIONS where NumVol = ?";
+ foreach ($flights as $flight) {
+ $sql_pquery = "select sum(NbPlaces) as BookedPlaces from RESERVATIONS where NumVol = ?";
$connection->prepare_query($sql_pquery);
- $connection->prepared_query_bind_param("s", array($fligth['NumVol']));
+ $connection->prepared_query_bind_param("s", array($flight['NumVol']));
$connection->run_prepared_query();
$connection->get_pquery_result();
$rows = $connection->get_result_array();
@@ -143,26 +143,26 @@ if (!$input_failure) {
if (is_null($booked_places)) {
$booked_places = 0;
}
- if (isset($fligth['CapAv']) && isset($booked_places)) {
- $free_places = $fligth['CapAv'] - $booked_places;
+ if (isset($flight['CapAv']) && isset($booked_places)) {
+ $free_places = $flight['CapAv'] - $booked_places;
} else {
$free_places = "Inconnu";
}
echo " \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 " " . $flight['NumVol'] . " | \n";
+ echo " " . $flight['VilleD'] . " | \n";
+ echo " " . $flight['DateD'] . " | \n";
+ echo " " . $flight['VilleA'] . " | \n";
+ echo " " . $flight['DateA'] . " | \n";
+ echo " " . $flight['Classe'] . " | \n";
+ echo " " . $flight['Prix'] . "€ | \n";
echo "
- Places libres : " . $free_places . "
+ Nombre de places libres : " . $free_places . "
|