Basically here I am grabbing info about flights that have been completed and randomly grabbing from a list the next flight on from this and so on.
$departfrom ='LEMD';//Madrid
$query1 = mysql_query("SELECT * FROM timetable where departure='$departfrom' ORDER BY RAND() Limit 1") or die (mysql_error());
$Aflight = mysql_fetch_array($query1);
$query2 = mysql_query("SELECT * FROM timetable where departure='$Aflight[destination]' ORDER BY RAND() Limit 1") or die (mysql_error());
$Bflight = mysql_fetch_array($query2);
$query3 = mysql_query("SELECT * FROM timetable where departure='$Bflight[destination]' ORDER BY RAND() Limit 1") or die (mysql_error());
$Cflight = mysql_fetch_array($query3);
$query = mysql_query("SELECT * FROM timetable where flightno='$Aflight[0]' flightno='$Bflight[0]' flightno='$Cflight[0]'") or die (mysql_error());
basically I want to put the same data from all three results into a html table thats all and I thought it would be easyer to grab the data all at one point and then use $row to sort out the table.
added at edit 🙂 I need it to output the data in sequence in order for it to make any sence as it would be like leaving Madrid randomly selected landing at JFK randomly going from JFK to London so it would need to be outputted in that order if that also makes any sence.