$category = str_replace('-',' ',$_GET['categoryurl']);
$sql = "SELECT * FROM blogposts where store_slug='" .$siteurl. "' and poststatus='publish' and postdate<=now() and find_in_set('" .str_replace("-"," ",$category). "',category) order by postdate desc";
$result = $conn->query($sql);
if ($result->num_rows == 0)
$sql = "SELECT * FROM blogposts where storeid='' and poststatus='publish' and postdate<=now() and find_in_set('" .str_replace("-"," ",$category). "',category) order by postdate desc";
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($row = $result->fetch_assoc()){
?>
}
}else echo "There are no posts in this category.
";
?>