This topic is locked

total

5/5/2008 6:47:39 AM
PHPRunner General questions
F
futo author

hello,
i want to display total for all records on _list.php and _print.php
table name: _7164

fields in table : Datum, Racun, EUR, Kg
total field: Kg
I want to display total for all pages on print and list page because when user select some records i have total for them, but i want to see total for all records in page

that i will create with php spinet.
thanks

J
Jane 5/5/2008

Hi,
use custom event (Insert PHP code snippet option on the Visual Editor tab) for this purpose.

Here is a sample:

global $conn;

$rs = db_query("select count(*) from TableName",$conn);

if ($data = db_fetch_numarray($rs))

echo "Summary: ".$data[0];

F
futo author 5/5/2008

Hi,

use custom event (Insert PHP code snippet option on the Visual Editor tab) for this purpose.

Here is a sample:


SORRY
i want custom event for total of all records for field Kg (sum all values in all records)
thanks

J
Jane 5/5/2008

Sorry for my fault.

Here is the correct code:

global $conn;

$rs = db_query("select sum(kg) from TableName",$conn);

if ($data = db_fetch_numarray($rs))

echo "Summary: ".$data[0];