Fairly new to php- creating a simple flight website.
Basically i have an input page with drop down boxes, containing year month and day
The user submits these, picked up on the next page, works fine.
However i want to run a query using the dates inputted to search my database to look for corresponding flights. But the dates on the database are stored as yyyy-mm-dd.
I need a function that will combine the seperate years, months and days into the format on the database.
I have tried to put them into one variable, as you will see, but that didnt work, or at least i didn't do it correctly.
I have one more problem after this, but i'll get this one sorted first 🙂
my code, if it helps..
<?php
error_reporting(E_ALL);
$returnday= $_GET["flightreturnday"];
$returnmonth= $_GET["flightreturnmonth"];
$returnyear= $_GET["flightreturnyear"];
$returndate="$returnday-$returnmonth-$returnyear"; //Attempt at grouping them
$outboundday= $_GET["flightoutboundday"];
$outboundmonth= $_GET["flightoutboundmonth"];
$outboundyear= $_GET["flightoutboundmonth"];
$outbounddate="$outboundyear-$outboundmonth-$outboundyear"; //Attempt at grouping them
$flight_table="flight";
$query= "Select * From '$flight_table'
Where DepartureDate= '$outbounddate' ";
$result= mysql_query ($query,$myconn2);
if (!$result) {
$message= 'Query Failed: ' . mysql_error() ."\n";
$message= 'Whole query: ' . $query;
die ($message);
}
while ($row= mysql_fetch_array($result)) {
echo "Airline: ".$row['Airline']."<br />";
echo "From: ".$row['DepartureAirport']."<br />";
echo "Date: ".$row['DepartureDate']."<br />";
echo "Time: ".$row['DepartureTime']."<br />";
echo "To: ".$row['DestinationAirport']."<br />";
echo "Fare: ".$row['Fare']."<br />";
echo "<hr>";
}
?>