\r\n"; mail('jim.rolt@googlemail.com', $subject, $error, $headers); } include('dataedit/sql.php'); if(intval($_GET['county']) > 0 && intval($_GET['county']) < 142){ $county = intval($_GET['county']);} else{ header("HTTP/1.1 404 Not Found"); header("Location: https://information-britain.co.uk/errordoc.php"); exit(); } $sql = "SELECT Towns.Name AS townname, EstType, Cities.Name FROM Cities INNER JOIN Towns ON Cities.ID = Towns.City INNER JOIN EstDetails ON EstDetails.Town = Towns.Name AND EstDetails.County = $county WHERE Cities.County = $county ORDER BY Cities.Name, townname"; $q = mysql_query($sql)or mailjim('q',"$sql\n".mysql_error()); if(mysql_num_rows($q) == 0){ header("HTTP/1.1 404 Not Found"); header("Location: https://information-britain.co.uk/errordoc.php"); exit(); } $sql = "SELECT CountyName, Region FROM CountyDetails WHERE RecordID = $county"; $ccc = mysql_query($sql)or mailjim('ccc', "$sql\n".mysql_error()); $stuff = mysql_fetch_object($ccc); echo << The Regions of UK cities, $stuff->CountyName EOT; ?>
The regions of $stuff->CountyName\n"; include'linkunit.txt'; echo "
"; $tsorter= array(); $counter= array(); while($row = mysql_fetch_object($q)){ $town = ucwords(trim(strtolower(str_replace('-', ' ', $row->townname))));//get rid of white space, allow for different capitalisation and hyphens/spaces $tsorter["$row->Name"]["$town"][] = $row->EstType;//create multi dimensional array of towns with all possible est types $counter[] = $town; } $counter = array_unique($counter); $count = 0; $num = floor(count($counter)/2); foreach($tsorter as $key => $trow){ if($count >= $num && !isset($stop)){ echo'
'; $stop = 1; } echo"$key
\n"; foreach($trow as $key =>$row){ echo'$key
\n";} elseif(in_array(2, $row)){echo"bnbtowns.cfm?town=".rawurlencode($key)."&county=$county'>$key
\n";} elseif(in_array(4, $row) || in_array(15, $row)){echo"selfctowns.cfm?town=".rawurlencode($key)."&county=$county'>$key
\n";} elseif(in_array(7, $row) ){echo"budgettowns.cfm?town=".rawurlencode($key)."&county=$county'>$key
\n";} else{echo"county$county/townguide".rawurlencode($key)."/'>$key
\n";} $count ++; } } echo '
'; include'dailyfeature.php'; ?>