I am facing problem on sum of dynamic array value.
For example :
tablename : totalamt
ref_no | Amount
1 | 58
2 | 12
3 | 11
i am using check box to select the ref_no.
now i am selecting 3 check box now and submit it.
Now it has to show sum of amount. But i am able to get only the First value i.e(58)
$receipt_ref_no = $_POST['ref_no'];
$limit = count($receipt_ref_no);
for($i=0;$i<$limit;$i++)
{
$receipt_ref_no[$i] = mysql_real_escape_string($receipt_ref_no[$i]);
$receipt_ref_nu = $receipt_ref_no[$i];
echo $q = "select * from totalamt where ref_no='".$receipt_ref_nu."' group by ref_no";
$r = mysql_query($q,$conn);
$m = mysql_fetch_array($r);
But i need the below value.
Please any one can help me
Total Amount : 81