+ 1

Wampserver: Using PHP

How to fix this, it displays on localhost; Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C. Here where it appears; if(isset($_POST["getProduct"])){ $limit = 9; if(isset($_POST["setPage"])){ $pageno = $_POST["pageNumber"]; $start = ($pageno * $limit) - $limit; }else{ $start = 0; } $product_query = "SELECT * FROM products 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']; echo " <div class='col-md-4'> <div class='panel panel-info'> <div class='panel-heading'>$pro_title</div> <div class='panel-body'> <img src='product_images/$pro_image' style='width:160px; height:250px;'/> </div> <div class='panel-heading'>$.$pro_price.00 <button pid='$pro_id' style='float:right;' id='product' class='btn btn-danger btn-xs'>AddToCart</button> </div> </div> </div> "; } } }

11th Sep 2019, 5:45 AM
Don Loic
1 Resposta
+ 7
mysqli_num_rows() function expects one of the parameters to be mysqli_result. Check this: https://w3schools.com/php/func_mysqli_num_rows.asp
11th Sep 2019, 10:41 AM
Oma
Oma - avatar