Forum Moderators: coopster
example of what u want:
$query2 = "select * from Distances where HotelID ='$ID'";
$result2 = mysql_query($query2);
while ($row2=mysql_fetch_assoc($result2))
{
$Airport = $row2['Airport'];
$Port = $row2['Port'];
$Center = $row2['Center'];
$Beach = $row2['Beach'];
$FlagDistance = $row2['FlagDistance'];
};
$query3 = "select * from Hfacilities where HotelID ='$ID'";
$result3 = mysql_query($query3);
while ($row3=mysql_fetch_assoc($result3))
{
$HFD = $row3['FD'];
$HFN = $row3['FN'];
$HRE = $row3['RE'];
$HPO = $row3['PO'];
$HIN = $row3['NN'];
$HST = $row3['ST'];
$HAC = $row3['AC'];
$HBR = $row3['BR'];
$HBA = $row3['BA'];
$HGA = $row3['GA'];
$HLS = $row3['LS'];
$HPA = $row3['PA'];
$FlagHFacilities = $row3['Flag'];
};
The thing to watch is that
- You don't have queries executing inside loops unless it's genuinely necessary
- you index the columns you search on (at least in large tables without a lot of redundant entries in the given column)
- you don't use 2-3 queries where one will do
stuff like that