I'm trying to add products on basket but i'ts not working fine. I'm getting a warning
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\Esigelec Online Sales 2019\cart.php on line 121
I've a database called cart.
<?php
$ip = getIp();
$total = 0;
$sel_price = "select * from cart where ip_add = '$ip'";
$run_price = mysqli_query($con,$sel_price);
while($cart_row = mysqli_fetch_array($run_price)){
$pro_id = $cart_row['p_id'];
$pro_qty = $cart_row['qty'];
$pro_price = "select * from products where pro_id = '$pro_id' and sflag = 0;";
$run_pro_price = mysqli_query($con, $pro_price);
while ($pro_row = mysqli_fetch_array($run_pro_price)){
$pro_title = $pro_row['pro_title'];
$pro_image = $pro_row['pro_image'];
$pro_price = $pro_row['pro_price'];
$pro_price_all_items = $pro_price * $pro_qty;
$total += $pro_price_all_items;
?>
<tr align="center">
<td><input type="checkbox" name="remove[]"
value="<?php echo $pro_id; ?>"></td>
<td><?php echo $pro_title; ?> <br>
<img src="admin/product_images/<?php echo $pro_image; ?>"
width="60" height="60">
</td>
<td><input size="2" name="qty[]" value="<?php echo $pro_qty;?>">
<input name="product_id[]" type="hidden" value="<?php echo $pro_id;?>">
</td>
<td><?php echo "$".$pro_price ; ?></td>
<td><?php echo "$".$pro_price_all_items; ?></td>
</tr>
<?php
}
}
?>
This line causes the problem: while ($pro_row = mysqli_fetch_array($run_pro_price))