"; } if(isset($_POST["page"])){ $sql = "SELECT * FROM products"; $run_query = mysqli_query($con,$sql); $count = mysqli_num_rows($run_query); $pageno = ceil($count/2); for($i=1;$i<=$pageno;$i++){ echo "
  • $i
  • "; } } if(isset($_POST["getProducthome"])){ $limit = 3; if(isset($_POST["setPage"])){ $pageno = $_POST["pageNumber"]; $start = ($pageno * $limit) - $limit; }else{ $start = 0; } $product_query = "SELECT * FROM products,categories WHERE product_cat=cat_id LIMIT $start,$limit"; $run_query = mysqli_query($con,$product_query); if(mysqli_num_rows($run_query) > 0){ while($row = mysqli_fetch_array($run_query)){ $pro_id = $row['product_id']; $pro_cat = $row['product_cat']; $pro_brand = $row['product_brand']; $pro_title = $row['product_title']; $pro_price = $row['product_price']; $pro_image = $row['product_image']; $cat_name = $row["cat_title"]; echo "

    $cat_name

    $pro_title

    $pro_price$990.00

    "; } } } if(isset($_POST["gethomeProduct"])){ $limit = 9; if(isset($_POST["setPage"])){ $pageno = $_POST["pageNumber"]; $start = ($pageno * $limit) - $limit; }else{ $start = 0; } $product_query = "SELECT * FROM products,categories WHERE product_cat=cat_id AND product_id BETWEEN 71 AND 74"; $run_query = mysqli_query($con,$product_query); if(mysqli_num_rows($run_query) > 0){ while($row = mysqli_fetch_array($run_query)){ $pro_id = $row['product_id']; $pro_cat = $row['product_cat']; $pro_brand = $row['product_brand']; $pro_title = $row['product_title']; $pro_price = $row['product_price']; $pro_image = $row['product_image']; $cat_name = $row["cat_title"]; echo "

    $cat_name

    $pro_title

    $pro_price$990.00

    "; $rating_query = "SELECT ROUND(AVG(rating),1) AS avg_rating FROM reviews WHERE product_id='$pro_id '"; $run_review_query = mysqli_query($con,$rating_query); $review_row = mysqli_fetch_array($run_review_query); if($review_row > 0){ $avg_count=$review_row["avg_rating"]; $i=1; while($i <= round($avg_count)){ $i++; echo' '; } $i=1; while($i <= 5-round($avg_count)){ $i++; echo' '; } } echo "
    "; } ; } }