- global $connection;
- $sql_pquery = "select VOLS.NumVol as NumVol, VilleD, DateD, VilleA, DateA, Classe, round(CoutVol*CoeffPrix, 2) as Prix 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();
- //var_dump($rows);
- if (empty($rows)) {
- echo "Aucun vol ne correspond aux critères de recherche. <br>";
- } else {
- echo "<table id=\"search\">\n";
- echo " <tr>\n";
- echo " <th>Numéro de vol</th>\n";
- echo " <th>Ville de départ</th>\n";
- echo " <th>Date de départ</th>\n";
- echo " <th>Ville d'arrivée</th>\n";
- echo " <th>Date d'arrivée</th>\n";
- echo " <th>Classe</th>\n";
- echo " <th>Prix d'une place</th>\n";
- echo " <th>Réserver</th>\n";
- echo " </tr>\n";
- foreach ($rows as $row) {
- echo " <tr>\n";
- echo " <td>" . $row['NumVol'] . "</td>\n";
- echo " <td>" . $row['VilleD'] . "</td>\n";
- echo " <td>" . $row['DateD'] . "</td>\n";
- echo " <td>" . $row['VilleA'] . "</td>\n";
- echo " <td>" . $row['DateA'] . "</td>\n";
- echo " <td>" . $row['Classe'] . "</td>\n";
- echo " <td>" . $row['Prix'] . "€</td>\n";
- echo " <td>
+ 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. <br>";
+ } else {
+ echo "<table id=\"search\">\n";
+ echo " <tr>\n";
+ echo " <th>Numéro de vol</th>\n";
+ echo " <th>Ville de départ</th>\n";
+ echo " <th>Date de départ</th>\n";
+ echo " <th>Ville d'arrivée</th>\n";
+ echo " <th>Date d'arrivée</th>\n";
+ echo " <th>Classe</th>\n";
+ echo " <th>Prix d'une place</th>\n";
+ echo " <th>Réserver</th>\n";
+ echo " </tr>\n";
+ foreach ($rows as $row) {
+ echo " <tr>\n";
+ echo " <td>" . $row['NumVol'] . "</td>\n";
+ echo " <td>" . $row['VilleD'] . "</td>\n";
+ echo " <td>" . $row['DateD'] . "</td>\n";
+ echo " <td>" . $row['VilleA'] . "</td>\n";
+ echo " <td>" . $row['DateA'] . "</td>\n";
+ echo " <td>" . $row['Classe'] . "</td>\n";
+ echo " <td>" . $row['Prix'] . "€</td>\n";
+ echo " <td>