页脚折叠php动态代码

时间:2018-04-30 16:35:19

标签: php html mysql

点击shop.php

selecting product by category之后

我的页脚有问题。当我按类别选择产品时,页脚会出现并覆盖为基于类别选择的产品分配的空间。后 selecting category with no product.

有人可以告诉我我的代码有什么问题吗?这是我的shop.php代码

<?php
include('includes/db.php');
?>
<?php include('functions/functions.php'); ?>

<?php
include_once 'header.php';

?>
<?php
include_once 'topheader.php';

?>
<?php
include_once 'nav.php';

?>

<div id="content">
<div class="container">
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="index.php">Home</a></li>
<li><a href="index.php">Shop</a></li> 

</ul>  <!--breadcrumb ends--->  
</div> <!---col-md-12 ends-->

<div class="col-md-3">
<?php include("sidebar.php"); ?>  
</div> <!--col-md-3 ends--->

<div class="col-md-9">
<?php
if(!isset($_GET['p_cat'])){    
if(!isset($_GET['cat'])){

echo"
<div class='box'>
<h1>Welcome To Our Shop</h1>
<p>India's biggest online store for Paint,Dyes &amp; Tools and more! Largest selection from all Categories at lowest price.Payment options - COD,EMI,Credit card,Debit card &amp; more. Buy Now!</p>
</div>";
} 
}
?>

<div class="row">    
<?php
if(!isset($_GET['p_cat'])){     
if(!isset($_GET['cat'])){    
 $per_page=6;
if(isset($_GET['page'])){
$page= $_GET['page'];    

}else{
    $page=1;

}
$start_from=($page-1) * $per_page;
$get_products="select * from products order by 1 DESC LIMIT $start_from,$per_page";
$run_products=mysqli_query($conn,$get_products);
while($row=mysqli_fetch_array($run_products)){
    $pro_id=$row['product_id'];
    $pro_title=$row['product_title'];
    $pro_price=$row['product_price'];
    $pro_img1=$row['product_img1'];

    echo "
    <div class='col-md-4 col-sm-6 center-responsive'>
<div class='product'>
 <div class='products'>
<a href='details.php?pro_id=$pro_id'>
<img src='admin_area/product_images/$pro_img1'  class='img-responsive'>    
</a> 

<div class='text'>
<h3><a href='details.php?pro_id=$pro_id'>$pro_title</a></h3>
<p class='price'>&#x20b9; $pro_price </p>
<p class='buttons'>
<a href='details.php?pro_id=$pro_id' class='btn btn-default'>View Product</a>
<a href='details.php?pro_id=$pro_id' class='btn btn-primary'><i class='fa fa-shopping-cart'></i>Add to Cart</a>
</p>
</div>    
</div>      

</div>     
</div>   ";
}

  ?>  

</div>  <!--row ends--->   

<center> 
<ul class="pagination">
<?php
$query="select * from products";
    $result=mysqli_query($conn,$query);
    $total_records=mysqli_num_rows($result);
    $total_pages= ceil($total_records / $per_page);
    echo"<li><a href='shop.php?page=1'>".'First Page'."</a></li>";
    for($i=1;$i<=$total_pages;$i++){
        echo"<li><a href='shop.php?page=".$i."'>".$i."</a></li>";
    };
    echo"<li><a href='shop.php=$total_pages'>".'Last Page'."</a></li>";
}
    }

    ?>
</ul> <!---ul ends-->   
</center> <!--center end-->
<?php 
    getPCatpro();

    ?>    
</div> <!---col-md-9 ends--->   -
</div> <!--container ends--> 
</div> <!---content ends-->





<?php include_once 'footer.php'; ?>

0 个答案:

没有答案