<?php include("includes/db.php");?>

<?php
    $idn=$_GET['idn'];
$sql=mysqli_query($db, "SELECT * FROM books WHERE idn='$idn' ");
$result=mysqli_fetch_assoc($sql);
$rows=mysqli_num_rows($sql);
if($rows ==0){
    header('location:/');
    exit();
}
$image=$result['image'];
$title=$result['btitle'];
$author=$result['author'];
$pub=$result['pub'];
$lang=$result['lang'];
$isbn=$result['isbn'];
$cat=$result['cat'];
$copy=$result['copyright'];
$about=$result['aboutbook'];
?>



<!-- header starts here -->
<?php include('includes/header.php') ?>
<!-- header ends here -->


<section class="hero-wrap hero-wrap-2" style="background-image: url('images/bg_5.jpg');" data-stellar-background-ratio="0.5">
      <div class="overlay"></div>
      <div class="container">
        <div class="row no-gutters slider-text align-items-center justify-content-center">
          <div class="col-md-9 ftco-animate mb-0 text-center">
          	<p class="breadcrumbs mb-0"><span class="mr-2"><a href="index.html">Home <i class="fa fa-chevron-right"></i></a></span> <span>Book Store <i class="fa fa-chevron-right"></i></span></p>
            <h1 class="mb-0 bread">Book Blog</h1>
          </div>
        </div>
      </div>
	</section>

	  <section class="ftco-section">
      <div class="container">
        <div class="row justify-content-center mb-5">
          <div class="col-md-7 heading-section text-center ftco-animate">
          	<span class="subheading">Books</span>
            <h4><?php echo $title?> </a></h4>
          </div>
        </div>
        <div class="row d-flex">
          <div class="col-md-6 d-flex ftco-animate">
          	<div class="blog-entry justify-content-end">
              <div class="text text-center">
              	<img src="admin/bookimage/<?php echo $image?>" class="img-fluid" alt="">
                </div>	
				</div>
				
                </div>
		 
          <div class="col-md-6 d-flex ftco-animate">
          	<div class="blog-entry justify-content-end">
              <div class="text text-center">
				<h3 class="heading mb-3"><a href="#"><?php echo $title?> </a></h3>
				<div id="accordianId" role="tablist" aria-multiselectable="true">
					<div class="card">
						<div class="card-header" role="tab" id="section1HeaderId">
							<h5 class="mb-0">
								<a data-toggle="collapse" data-parent="#accordianId" href="#section1ContentId" aria-expanded="true" aria-controls="section1ContentId">
								Book Details
						</a>
							</h5>
						</div>
						<div id="section1ContentId" class="collapse in" role="tabpanel" aria-labelledby="section1HeaderId">
							<div class="card-body">
							<p><?php echo $author?></p>
								<p><?php echo $pub?></p>
								<p>	<?php echo $isbn?></p>
								<p><?php echo $cat?></p>
								<p><?php echo $lang?></p>
								<p><?php echo $copy?></p>
							</div>
						</div>
					</div>
					<div class="card">
						<div class="card-header" role="tab" id="section2HeaderId">
							<h5 class="mb-0">
								<a data-toggle="collapse" data-parent="#accordianId" href="#section2ContentId" aria-expanded="true" aria-controls="section2ContentId">
						  Read About Book
						</a>
							</h5>
						</div>
						<div id="section2ContentId" class="collapse in" role="tabpanel" aria-labelledby="section2HeaderId">
							<div class="card-body">
							<p><?php echo $about?></p>
							</div>
						</div>	
					</div>
				</div>
			
			   <!-- PUCHASE BUTTON STARTS -->
			   <div class="pt-3 p-2 purchase">
				<h4 class="text-danger text-center"> PUCHARSE NOW</h4>
			  <div class="list-group text-center ">
        <?php
          $lidn=$_GET['idn'];
 $sql=mysqli_query($db, "SELECT * FROM link WHERE idn ='$lidn'");
 while($row=mysqli_fetch_assoc($sql)){
$lname=$row['name'];
$link=$row['link'];
$lid=$row['id'];

?>
              <P><a href="<?php echo $link ?>" class="list-group-item list-group-item-action badge badge-danger"><?php echo $lname ?> </a></p>
			       
        <?php }?>
      
      </div>
            </div>
          </div>
		  </div>
       <!-- PUCHARSE BUTTON ENSS -->
		 
		 
		</div>
      </div>	
				
		</div>
		
	</div>
</section>


	 <!-- BOOKS STARTS HERE -->
  
	 <section class="ftco-section testimony-section ftco-no-pb mt-4">
    	<div class="img img-bg border" style="background-image: url(images/h.jpg);"></div>
    	<div class="overlay"></div>
      <div class="container">
        <div class="row justify-content-center mb-5">
          <div class="col-md-7 text-center heading-section heading-section-white ftco-animate">
          	<span class="subheading" id="testi">Books</span>
            <h2 class="mb-3">Books You May Like</h2>
          </div>
        </div>
        <div class="row ftco-animate">
          <div class="col-md-12">
            <div class="carousel-testimony owl-carousel ftco-owl">
    <?php
 $sql=mysqli_query($db, "SELECT * FROM books WHERE idn !='$idn'");
 while($row=mysqli_fetch_assoc($sql)){
$image=$row['image'];
$idn=$row['idn'];

?>

<div class="item">
                <div class="testimony-wrap py-4">
                	<div class="icon d-flex align-items-center justify-content-center"><span class="fa fa-quote-left"></div>
                  <div class="img">
				  <img src="admin/bookimage/<?php echo $image?>" alt="">
                  
                    <div class="d-flex align-items-center ">
                    	<div class="ml-5 mt-2 d-flex justify-content-center">
						<p class="text-center ml-5"><a class="btn btn-danger btn-sm center" href="bookidn.php?idn=<?php echo $idn?>">Read More</a></p>
		            
		                    
		                  </div>
	                  </div>
                  </div>
                </div>
              </div>

              <?php }?>
                 
              </div>
          </div>
        </div>
      </div>
    </section>

	<!-- BOOKS ENDS HERE -->


       
<!-- footer starts here -->
<?php include('includes/footer.php') ?>
        <!-- footer ends here -->