<?php
require('db.php');
include "x.php";
?>

<?php
    if (isset($_GET['cat'] )) {

    $receive_cat = $_GET['cat'];

    $news_sql = "SELECT * FROM blog WHERE bcat = '$receive_cat' order by bid DESC ";
    $news_run = mysqli_query($con, $news_sql);
  
?>
<!doctype html>
<html lang="en">
  <head>
    
     <?php include "include/meta.php"; ?>

     <?php include "include/css.php"; ?>

  </head>
  <body>
<?php include "include/header.php"; ?>

   <?php                   
	    $see_run = mysqli_query($con, "SELECT * FROM category WHERE cid = '$receive_cat'");
	    $see_rowl = mysqli_fetch_assoc($see_run);
	?>



<section class="w3l-contact-breadcrum">
  <div class="breadcrum-bg py-sm-5 py-4">
    <div class="container py-lg-3">
        <h2><?php echo $see_rowl["cname"]; ?></h2>
      <p><a href="index.php">Home</a> &nbsp; / &nbsp;<?php echo $see_rowl["cname"]; ?></p>
    </div>
  </div>
</section>

<section class="w3l-blog-single">
	<div class="single blog py-5">
	  <div class="container py-md-3">
		  <div class="row">

	<?php
          while ( $news_rowsl = mysqli_fetch_assoc($news_run) ) {
             $newsPath = substr($news_rowsl['bimage'], 3);
			 $newsPath = "login/".$newsPath;
            $trimmedTitle = mb_strimwidth($news_rowsl['btitle'], 0, 74, "...");
	?>

			<div class="col-md-3 mt-5">
				<div class="blg-img">
			  <a href='blog-single.php?id=<?php echo "$news_rowsl[bid]/$news_rowsl[btag]/";?>' title=" <?php echo $news_rowsl['btitle']; ?> "><img src="<?php echo $newsPath ; ?>" alt=" " class="img-responsive img-fluid">
			  <div class="bl-top">
				<h6 style="font-size: 14px;"><?php echo $news_rowsl['bcreated'];?></h6>
			 </div></a>
			</div>
			 
			  <div class="btom-cont" style="height: 160px;">
			  		<span class="fa fa-tag" style="color: orange;"> <?php echo $see_rowl["cname"]; ?></span>
				<p class="card-title" style="font-size: 16px;"><a href='blog-single.php?id=<?php echo "$news_rowsl[bid]/$news_rowsl[btag]/";?>'><b><?php echo $trimmedTitle;?></b></a></p>
				
			  </div>
			</div>
	<?php 

		}

 	?>
			


		</div>
	  </div>
	</div>
  </section>

  
<?php include "include/footer.php"; ?>
<?php include "include/js.php"; ?>

</body>

</html>
<?php 
}
 ?>
<!-- // grids block 5 -->


