\r\n"; mail('jim.rolt@googlemail.com', $subject, $error, $headers); } include('dataedit/sql.php'); $county = is_numeric($_GET['county']) ? intval($_GET['county']) : 1; $town = isset($_GET['town']) ? mysql_real_escape_string($_GET['town']) : 'Worcester'; $sql = "SELECT id, name, fdate AS year, detail, CountyName FROM famousdates LEFT JOIN CountyDetails ON CountyDetails.RecordID = famousdates.county WHERE county = $county AND town = '$town' ORDER BY fdate ASC "; //echo $sql; $q = mysql_query($sql)or mailjim('q', "$sql\n".mysql_error()); if(isset($_GET['county'])){ $cname = mysql_fetch_object($q); mysql_data_seek($q, 0); $text = "Famous dates in {$_GET['town']}:
\n"; } $co = mysql_query("SELECT DISTINCT RecordID, CountyName, Country.Name AS cname, Country.ID AS cid FROM CountyDetails INNER JOIN famousdates ON famousdates.county = CountyDetails.RecordID INNER JOIN Country ON Country.ID = CountyDetails.CountryID ORDER BY cid, CountyName")or mailjim("co", mysql_error()); $dates = mysql_query("SELECT DISTINCT SUBSTRING(fdate, 1, 4) AS year FROM famousdates ORDER BY fdate")or mailjim("dates", mysql_error()); if(mysql_num_rows($q) == 0){ $text = 'Sorry, we dont have any results for your search. Please try again'; } echo <<Famous Dates in {$_GET['town']} EOT; ?>

Historic British Dates

Search by name:   or

0){ $check = ''; $no = 1; while($row = mysql_fetch_object($q)){ if(!empty($row->year)){ if(strlen($row->year) == 10){ $months= array('01'=>"January",'02'=>"February",'03'=>"March",'04'=>"April",'05'=>"May",'06'=>"June",'07'=>"July",'08'=>"August",'09'=>"September",'10'=>"October",'11'=>"November",'12'=>"December"); $month = $months[substr($row->year, 5, 2)]; $day = substr($row->year, 8, 2); $day = (substr($day, 0, 1) == 0) ? substr($day, 1) : $day; switch($day){ case(substr($day, -1, 1) == 1 && substr($day, 0, 1) != 1): $suffix = 'st'; break; case(substr($day, -1, 1) == 2 && substr($day, 0, 1) != 1): $suffix = 'nd'; break; default: case(substr($day, -1, 1) == 3): $suffix = 'rd'; break; default: $suffix = 'th'; } $yy = substr($row->year, 0, 4); if(substr($yy, 0, 1) == 0){ $yy = substr($yy, 1);} $fdate = "$day$suffix of $month $yy :"; } else{$fdate = $yy = $row->year;} echo"$fdate "; } if(!empty($row->detail)){echo"$row->name\n";} else{echo"$row->name\n";} if($no < mysql_num_rows($q)){echo'
';} $no++; } } echo'

Click below to list Historic Dates by County:

'; while($cou = mysql_fetch_object($co)){ if($check != $cou->cname){ echo"$cou->cname: "; $check = $cou->cname; } echo"$cou->CountyName | \n"; } echo'

'; include'books.txt'; include'dailyfeature.php'; ?>