This topic is locked

Total over all pages

10/11/2006 9:47:43 AM
PHPRunner General questions
P
psychodad71 author

I would like to build an account statement. Therefore it is important to build a totol for the page and a total for all pages to display the account ballance.

J
Jane 10/12/2006

Hi,
you can add total for the current page on the Fields order and totals tab.
To show total for all pages (for whole table) use ListOnLoad event on the Events tab.

Here is a sample code:

global $conn;

$from=stristr ($strSQL," from ");

$order=strrpos($from," order by");

if($order)

$from=substr($from,0,$order);

$sql = "select sum(FieldName) ".$from;

$rs=db_query($sql,$conn);

$data=db_fetch_numarray($rs);

echo $data[0];



where FieldName is your actual field name.