ahh hang on a sec does it go like so:
echo '<br><table cellspacing="1" bordercolor=#000000 cellpadding="2" border="2">';
echo "<tr><td>Departure Time</td><td>Arrival Time</td><td>Departing From</td><td>Departing To</td><td>Aircraft Reg</td><td>Duration Of Flight (Hours)</td><td>Flight Number</td></tr>";
$a = "
Select
t1.ID as id,
t1.StartTime as departure,
t1.LandTime as arrival,
t2.AirportName as origin,
t3.AirportName as destination,
t1.Aircraft as aircraft,
t1.TotalHours as hours,
t1.flightno as flightno,
t1.datetime as DateTime
From
$table3 t1,
$table5 t2,
$table5 t3,
Where
t2.icao=t1.Frm
and t3.icao=t1.Too
and t1.PilotID=$pid
Order by t1.DateTime ASC
";
//echo $a;
$b = mysql_query($a)or die(mysql_error());
while ($row = mysql_fetch_assoc($b)){
$id = $row['ID'];
$totime = $row['departure'];
$LndTime = $row['arrival'];
$from = $row['origin'];
$to = $row['destination'];
$acrft = $row['aircraft'];
$Hours = $row['hours'];
$fltno = $row['flightno'];
$dati = $row['datetime'];
$Hours = m2h($Hours);
echo "<tr><td>$totime</td><td>$LndTime</td><td>$apname</td><td>$apname2</td><td>$acrft</td><td>$Hours</td><td>$fltno</td></tr>";
}
because if that hows you use it i get the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Where t2.icao=t1.Frm and t3.icao=t1.Too and t1.PilotID=0002 Order by t1.DateTi' at line 15