\r\n";
mail('jim.rolt@googlemail.com', $subject, $error, $headers);
}
$type = (is_numeric($_GET['type'])) ? $_GET['type'] : 2;
switch($type){
case 2:
$sql = "SELECT Shops.ID, Shops.Name, town, county, ShopTypes.type, CountyDetails.CountyName, CountryID, Country.Name AS cname
FROM Shops
INNER JOIN reviews ON reviews.est = Shops.ID AND reviews.display = 1 AND reviews.type = 2
INNER JOIN ShopTypes ON ShopTypes.ID = Shops.type
INNER JOIN CountyDetails ON CountyDetails.RecordID = Shops.county
INNER JOIN Country ON CountyDetails.CountryID = Country.ID
ORDER BY CountryID, CountyName, Name";
$title = 'Shop';
break;
case 3:
$sql = "SELECT Sports.ID, Sports.Name, town, county, SportTypes.type, CountryID, CountyDetails.CountyName, Country.Name AS cname
FROM Sports
INNER JOIN reviews ON reviews.est = Sports.ID AND reviews.display = 1 AND reviews.type = 3
INNER JOIN SportTypes ON SportTypes.ID = Sports.type
INNER JOIN CountyDetails ON CountyDetails.RecordID = Sports.county
INNER JOIN Country ON CountyDetails.CountryID = Country.ID
ORDER BY CountryID, CountyName, Name";
$title = 'Sport';
break;
case 4:
$sql = "SELECT events.eventid AS ID, events.event AS Name, town, county, CountryID, CountyDetails.CountyName, Country.Name AS cname
FROM events
INNER JOIN reviews ON reviews.est = events.eventid AND reviews.display = 1 AND reviews.type = 4
INNER JOIN CountyDetails ON CountyDetails.RecordID = events.county
INNER JOIN Country ON CountyDetails.CountryID = Country.ID
ORDER BY CountryID, CountyName, event";
$title = 'Event';
break;
}
include('dataedit/sql.php');
$q = mysql_query($sql)or mailjim('q', "$sql\n".mysql_error());
echo <<
Independent Reviews on British {$title}s clubs
EOT;
?>
Independent reviews on British {$title}s clubs
\n";
include'linkunit.txt';
echo'
We have '.mysql_num_rows($q).' reviews posted since April 2005
';
$check = '';
$cncheck = '';
while($row = mysql_fetch_object($q)){
if($cncheck != $row->cname){
echo"$row->cname: \n";
$cncheck = $row->cname;
}
if($check != $row->county){
echo"$row->CountyName | ";
$check = $row->county;
}
}
mysql_data_seek($q, 0);
echo'
';
$counter = 0;
$check = '';
$ccheck = '';
while($row = mysql_fetch_object($q)){
if($ccheck != $row->county){
echo"
";
if($cncheck != $row->cname){
echo"$row->cname
\n";
$cncheck = $row->cname;
}
echo"$row->CountyName
\n";
$ccheck = $row->county;
}
if($check != $row->ID){
echo"- $row->Name, $row->town";
if(isset($row->type)){echo" ($row->type)";}
echo"
";
$check = $row->ID;
$counter++;
//every 20 lines put a to top link
if(($counter % 20) == 0){
echo"\n";
}
}
}
?>
Books: