"; $_SESSION['login_referer'] = $_SERVER['HTTP_REFERER']; redirect("index.php?page=login", 2); include('footer.html'); exit(); } $flight_id = filter_input(INPUT_GET, "flight_id", FILTER_SANITIZE_STRING); $class_name = filter_input(INPUT_GET, "class_name", FILTER_SANITIZE_STRING); $client_id = get_client_id($_SESSION['email']); echo "

Modification de la réservation sur le vol $flight_id

\n"; global $connection; $sql_pquery = "select NumCl, NumVol, Classe, NbPlaces from RESERVATIONS where NumCl = ? and NumVol = ? and Classe = ?"; $connection->prepare_query($sql_pquery); $connection->prepared_query_bind_param("iss", array($client_id, $flight_id, $class_name)); $connection->run_prepared_query(); $connection->get_pquery_result(); $rows = $connection->get_result_array(); $connection->close_prepared_query(); $sql_pquery = "select CapAv, sum(NbPlaces) as BookedPlaces from RESERVATIONS, VOLS, AVIONS where RESERVATIONS.NumVol = VOLS.NumVol and AVIONS.NumAv = VOLS.NumAv and RESERVATIONS.NumVol = ? group by RESERVATIONS.NumVol"; $connection->prepare_query($sql_pquery); $connection->prepared_query_bind_param("s", array($flight_id)); $connection->run_prepared_query(); $connection->get_pquery_result(); $rows_cap = $connection->get_result_array(); $connection->close_prepared_query(); //var_dump($rows_cap); $booked_places = $rows_cap[0]['BookedPlaces']; if (is_null($booked_places)) { $booked_places = 0; } if (isset($rows_cap[0]['CapAv']) && isset($booked_places)) { $free_places = $rows_cap[0]['CapAv'] - $booked_places; } else { $free_places = "Inconnu"; } ?>

Nombre de places libres :

Nombre de place(s) : \n"; echo " \n"; } ?>