 |
|
$OthersText = "Towns in this Region";
$Breadcrumburl = "http://www.myguidewales.com/";
$Breadcrumbfile = "/index.html";
//stuff to use when geo-coords are on database
//$geo_x=9.21;
//$geo_y=51.6;
//$Map = "http://images.12travel.com/geomap/drawmap.html?longitude=$geo_x&latitude=$geo_y";
include ('/home/sites/site5/require/req.html');
$db = "traveldb";
$connection = pg_connect("port=$port host=$server dbname=$db user=$user") or die("Invalid server or user");
// formulate the SQL query - town name
$query = "SELECT name FROM city WHERE city_id = '$town'" or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$myrow = pg_fetch_array($result,0);
$Town_name = $myrow["name"];
// formulate the SQL query - region
$query = "SELECT region.name_english FROM region, county, city
WHERE city.city_id = '$town'
AND city.county_id = county.county_id
AND region.region_id = county.region_id" or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$myrow = pg_fetch_array($result,0);
$region = $myrow["name_english"];
$regionurl = strtolower($region);
$regionurl = str_replace(" ", "", $regionurl);
// formulate the SQL query - content
$query = "SELECT body_text FROM content_text WHERE content_text.city_id = '$town'
" or die("Error in query");
// run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$myrow = @pg_fetch_array($result,0);
$Textcontent = $myrow["body_text"];
if (!$Textcontent)
{
$Textcontent = "Additional Information on this Location is currently available.";
}
else
{
$Textcontent = ' '.ereg_replace("(\r\n|\r|\n)"," ",$Textcontent).' ';
}
// formulate the SQL query - images
//$query = "SELECT filename, filetype, alt_text FROM image WHERE image.city_id = '$town'
//" or die("Error in query");
// run the query on the database
//$result = pg_exec($connection, $query) or die("Error in query");
//$myrow = pg_fetch_array($result,0);
// $image = $myrow["filename, filetype, alt_text"];
// memory flush
pg_FreeResult($result);
?>
HOME
: : ".(strtoupper ($region)).""?>:
|
| |
echo "";
echo "";
//Use the following line for the geo-coord map
//echo " ";
echo "
".(strtoupper ($Town_name))." ";
//$image = "/images/db/".filename.filetype;
$townname = strtolower($Town_name);
$townname = str_replace(" ", "", $townname);
$Image_loc = "/home/sites/site5/web/images/wales/town/".$townname."_200.jpg";
$Image_web = "http://images.12travel.com/images/wales/town/".$townname."_200.jpg";
$fp = @fopen($Image_loc,"r");
if ($fp)
{
fclose ($fp);
echo " ";
}
echo $Textcontent;
echo " | ";
//show the formatted region name in accommodation and town tables
$RegionText = ucwords(str_replace("_", " ", $region));
?>
// Region query
$query = "SELECT county.region_id FROM city , county WHERE
city_id = '$town' AND
city.county_id = county.county_id
" or die("Error in query");
//run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
$myrow = pg_fetch_array($result,0);
$reg_id = $myrow["region_id"];
// memory flush
pg_FreeResult($result);
// formulate the SQL query
$query = "SELECT city.name , city.city_id FROM city , county WHERE
city.county_id = county.county_id
AND county.region_id = $reg_id " or die("Error in query");
//run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
echo "";
echo "Towns in the $RegionText region | ";
echo "";
echo " ";
echo " ";
$limit = pg_numrows($result);
// with a while loop
// this loop will iterate as many times as there are records
while($numrow < $limit)
{
$myrow = pg_fetch_array($result, $numrow);
$Towns_name = $myrow["name"];
$Towns_id = $myrow["city_id"];
$numrow++;
$townsname = strtolower($Towns_name);
$townsname = str_replace(" ", "", $townsname);
echo "$Towns_name ";
}
echo " | ";
// formulate the SQL query
$query = "SELECT attraction.name_english , attraction.attraction_id FROM attraction, address, county WHERE
attraction.attraction_id = address.attraction_id
AND address.county_id = county.county_id
AND county.region_id = $reg_id " or die("Error in query");
//run the query on the database
$result = pg_exec($connection, $query) or die("Error in query");
echo "";
echo "Attractions in the $RegionText region | ";
echo "";
echo " ";
echo " ";
$limit = pg_numrows($result);
// with a while loop
// this loop will iterate as many times as there are records
$numrow = 0;
while($numrow < $limit)
{
$myrow = pg_fetch_array($result, $numrow);
$attraction_name = $myrow["name_english"];
$attraction_id = $myrow["attraction_id"];
$numrow++;
$attractionname = strtolower($attraction_name);
$attractionname = str_replace(" ", "", $attractionname);
echo "$attraction_name ";
}
echo " | ";
// memory flush
pg_FreeResult($result);
pg_Close();
?>
|
|
| |
| |
| |
| NEWSLETTER |
| |
 |
| |
| |
| |
|