<?php include_once'connection.php'; ?>
<?php
 $id = $_GET['slug']; 
 $top23 = $_GET['top'];

$det = mysqli_query($con, "SELECT * FROM tbl_product where slug='$id'");
$num=mysqli_num_rows($det);
while($roh = mysqli_fetch_array($det))
{
    $p_name = $roh['p_name'];
    $short = $roh['p_short_description'];
    $desc = $roh['specification'];
    $description = $roh['p_description'];
    $p_additional = $roh['additional_info'];
    $p_id = $roh['p_id'];
    $broucher = $roh['product_brochure'];
    $p_sku = $roh['p_sku'];
}

if($num == 0)
{
    ?>
   <script>window.location.href = "https://fmbmachinery.com/<?php echo 404 ?>";
</script>  
    
 <?php   
}

// echo "SELECT * FROM tbl_top_category where slug='$top23'";

$top = mysqli_query($con, "SELECT * FROM tbl_top_category where slug='$top23'");
$num34=mysqli_num_rows($top);
while ($roh = mysqli_fetch_array($top)) {
    $tcat_id = $roh['tcat_id'];
    $mcat_name = $roh['tcat_name'];
}

if($num34 == 0)
{
    
    
    
$top = mysqli_query($con, "SELECT * FROM tbl_mid_category where slug='$top23'");
$num34=mysqli_num_rows($top);
while ($roh = mysqli_fetch_array($top)) {
    $tcat_id = $roh['tcat_id'];
    $mcat_name = $roh['tcat_name'];
}

//      echo $top23 . '</br>';
//  echo $id;
//  exit;


    ?>
   <script>
//   window.location.href = "https://fmbmachinery.com/<?php echo 404 ?>";
</script>  
    
 <?php   
}
?>
<?php include_once'include/head.php'; ?>
<!-- oncontextmenu='return false' -->
<body class='snippet-body'>
    <link rel='stylesheet' href='https://sachinchoolur.github.io/lightslider/dist/css/lightslider.css'>
<!-- Top Bar Start -->
<?php include_once'include/header.php'; ?>
<!-- Top Bar End -->

<!-- Page Header Start -->

<!-- Page Header End -->

    <div class="container mt-2 mb-5">
        <div class="row">
            <div class="col-md-6">
                <div class="card">
                    <div id="demo" class="carousel slide" data-ride="carousel">

  <!-- Indicators -->
  <ul class="carousel-indicators">
    <li data-target="#demo" data-slide-to="0" class="active"></li>
    <li data-target="#demo" data-slide-to="1"></li>
    <li data-target="#demo" data-slide-to="2"></li>
  </ul>
  
  <!-- The slideshow -->
  <div class="carousel-inner">
    <?php
        $slider = mysqli_query($con, "SELECT * FROM `tbl_product_photo` where p_id='$p_id'");
        $count = 1;
        while ($sde = mysqli_fetch_array($slider)) {
        $img = $sde['photo'];
    ?>
    <div class="carousel-item <?php if($count == "1"){ echo "active"; } ?>">
      <img src="<?php path(); ?>/images/product-image/<?php echo $img; ?>" alt="Los Angeles" width="1100" height="500">
    </div>
    <?php
    $count++;
        }
    ?>
  </div>
  
  <!-- Left and right controls -->
  <a class="carousel-control-prev" href="#demo" data-slide="prev">
    <span class="carousel-control-prev-icon"></span>
  </a>
  <a class="carousel-control-next" href="#demo" data-slide="next">
    <span class="carousel-control-next-icon"></span>
  </a>
</div>
                   
                </div>
                
            </div>
            <div class="col-md-6">
                
                    <h3 class="mt-4"><?php echo $p_name; ?></h3>
                    <h6>Sku: <?php echo $p_sku; ?></h6>
                    <p><?php echo $desc; ?></p>
                    <a href="images/brochure/<?php echo $broucher; ?>" class="btn btn-primary">Download Brochure</a>
               
            </div>
        </div>
    </div>
    <div class="container mt-4">
        <div class="row">
            <div class="col-md-12">
                <p class="text-left"><?php echo $short; ?></p>
                    <p class="text-left"><?php echo $description; ?></p>
                    <p class="text-left"><?php echo $p_additional; ?></p>
            </div>
        </div>
    </div>

<?php include_once('include/footer.php'); ?>