My whole query works apart from this sub query:
"(SELECT a.NumSeats From Aircrafts a WHERE f.AircraftID =a.AircrafID)"
I want that to return a number e.g 5
As I am selecting a.NumSeats which is an integer I can't understand why this doesn't work.
Also this query will return a MAX of 1 row.
$subQuery1 = "(SELECT COUNT(*) from Seats s WHERE s.FlightID = f.FlightID)";
$subQuery2 = "(SELECT a.NumSeats From Aircrafts a WHERE f.AircraftID =a.AircrafID)";
$subQuery2 = 0;
$query = mysql_query("SELECT * FROM Flights f WHERE f.DeptAirport = '".$dep."' AND f.ArrAirport = '".$arr.
"' AND f.Date=STR_TO_DATE('".$depDate."', '%Y-%m-%d') AND ".$subQuery1. "=" .$subQuery2);
If i remove $subQuery2 = 0 it breaks