<?php
ob_start();
require('includes/cmain.inc.php'); ?> 
<?php
$qs1=explode("/",$_SERVER["REQUEST_URI"]);
$a=SITE_WS_PATH.'/'.$qs1[1].'/'.$qs1[2].'/'.$qs1[3];
$countryName=str_replace('-',' ',$qs1[2]);
$banner_match = ucwords(stripslashes($countryName));
$stateName=str_replace('-',' ',$qs1[3]);	
$SpCountyName =trim($qs1[4]);
$countyName = str_replace('-',' ',$SpCountyName);
$location_replace = ucwords(stripslashes($countyName));

  if($stateName=='tags')
{
$search_terms = explode(" ", $location_replace);
$sql_parts = array();
foreach ($search_terms as $term) {
    $sql_parts[] = "heading LIKE '%$term%'";
}
$sql_condition = implode(" OR ", $sql_parts);
//print_r("SELECT * FROM tbl_blog WHERE $sql_condition");exit();
    $resultTag = db_query("SELECT * FROM tbl_blog WHERE $sql_condition");
while($rowTag =mysqli_fetch_array($resultTag)){
    // print_r($rowcat);exit();
              // Convert to lowercase
$headingTag =str_replace(" ", "-",strtolower($rowTag['heading']));
 //print_r($headingTag);exit();print_r($headingTag);exit();
	  
	   if(!empty($headingTag)){
	 //  print_r($headingTag);exit();
		include('blog_tags.php');
		exit;
       }
       
    }
    
}
?>