This question already has an answer here:
I have searched for the correct answer but none of it helped me with this error. I have a page called profile.php
in which there are 3 different tabs with some informations generated from mysqli database. The problem is i have to show the orders in 3rd tab for which i have written some code. If no orders has been placed it should output "There are no orders placed till now!!". It shows the message but it also shows the warning.
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\XAMPP\htdocs\WebProject\profile.php on line 211
Here is my code for third tab.
Code
<div id="menu3" class="tab-pane fade">
<h3>My Orders</h3>
<?php
$q="select customers.*, orders.date,orders.status from orders inner join customers on orders.customerid=customers.serial_cust where customers.email='$email'" ;
$result=mysqli_query($con,$q);
if(mysqli_num_rows($result)>0){
while($row=mysqli_fetch_array($result))
{
$custid=$row['serial_cust'];
$ordersdate=$row['date'];
echo "<tr>";
echo "<h3>".$row['date']."</h3>";
echo "<h3> Status: Dispatched -> </h3> <p>".$row['status']."</p>";
echo"<table border='1'>";
$query="select customers.*, order_detail.*,orders.date,orders.customerid,products.* from order_detail inner join orders on orders.serial=order_detail.orderid inner join products on products.productid=order_detail.productid inner join customers on orders.customerid=customers.serial_cust where customers.serial_cust='$custid' and orders.date='$ordersdate' ";
$sql=mysqli_query($con,$query);
while($row=mysqli_fetch_array($sql))
{
?>
<tr>
<td><image width="80px" height="90px" src="assets/<?php echo $row['product_image'] ?>"/></td>
<td><?php echo $row['product_name']. " * ". $row['quantity']?></td>
<td><?php echo $row['color'] ?></td>
<td><?php echo $row['price'] ?></td>
<td><?php echo $row['size'] ?></td>
</tr>
<?php
}
echo "</table>";
}
}
else{
echo "You have not place any orders yet!";
}
?>
</div>
</div>