I am trying to find a sum of a column in mysql table but I get an error as below.
<?php require_once("../../../../512/1.001/data/class.php");
$sql=mysqli_query($db,"select SUM(tbl_ccp_loans.payableamount) AS total"); $row = mysqli_fetch_assoc($sql);
$sum = $row['total'];
$sum;?>
I expect the Total sum is 'Number' but the output is
Warning: mysqli_query() expects parameter 1 to be mysqli, object given in /home/testing/public_html/orrf/bej/ccp-main2/_dashboard/data.php on line 223
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /home/testing/public_html/orrf/bej/ccp-main2/modules/_dashboard/data.php on line 224