Too many tables output by this script. The following URL shows what I am talking about... Only 3 tables should be output but instead there is one for every country... I only want the three that should show up to show up.
http://journeys-intl.com/take_out/search_reviews_static2.php?country=Zimbabwe,%20South%20Africa,%20Zambia,%20Malawi,%20Tanzania,%20Kenya,%20Botswana
Here is the code:
<head>
<title>Journeys Search Results</title>
</head>
<body>
<?
include ("http://journeys-intl.com/includes/header.html");
//Split $country into an array and count the number of elements to determine how many loops to run
$countries = explode(", ", $country);
$numcountries = count($countries);
if (!$countries[0]) { $numcountries = 0; }
echo "<big><strong><font color=#008000>Trip Reviews for $country</font></strong></big><br><br>";
echo "<strong><font size=2 face=arial><img src='http://journeys-intl.com/images/arrow.gif' border=0 alt=arrow.gif><a href='javascript: history.go(-1)'> Back</a></font></strong><br>";
//Output Table
//Give it style
if ($countries[0]){
for($i=0; $i<$numcountries; $i++) {
$query = "SELECT * FROM trip_reviews WHERE country like '$countries[$i]'";
$result = mysql_query($query);
$myrow = mysql_fetch_array($result);
$trip_id = ($myrow["trip_id"]);
echo "<br><TABLE BGCOLOR=#003366 WIDTH=700 BORDER=1 CELLPADDING=4 CELLSPACING=1>";
echo "<tr>";
echo "<td bgcolor=#EEE8CD align=center><strong>Trip Name</strong></td>";
echo "<td bgcolor=#EEE8CD align=center><strong>Country</strong></td>";
echo "<td bgcolor=#EEE8CD align=center width=300><strong>Description</strong></td>";
echo "<td bgcolor=#EEE8CD align=center><strong>REVIEW</strong></td></tr>";
echo "<td valign=top bgcolor=#FFFFFF width=80><strong>";
echo $myrow['trp_name'];
echo "</strong></td>";
echo "<td valign=top bgcolor=#FFFFFF>";
echo $myrow['country'];
echo "</td>";
echo "<td valign=top bgcolor=#FFFFFF>";
echo $myrow['description'];
echo "</td>";
echo "<td valign=middle align=center bgcolor=#D8D8D8 width=70><strong>";
echo "<a href='trip_reviews.php?trip_id=$trip_id'>Read It!</a>";
echo "</strong></td></tr></table><br><br>";
}
}
if (!$countries[0]) {
echo "Sorry, no records were found.";
echo "<br><br><strong><font size=2 face=arial><img src='http://journeys-intl.com/images/arrow.gif' border=0 alt=arrow.gif><a href='javascript: history.go(-1)'> Back</a></font></strong>";
}
include ("http://journeys-intl.com/includes/footer2.html");
?>
</body>