This topic is locked

total of one column from all pages

9/3/2009 12:43:00 PM
PHPRunner General questions
samsp author

hi all,
i like to see on top of the page the summery of all totals from each page. example: on the first page the column "price" has on the end of the page a total of "10.000" the second page has a total of "13.000" the thired has "23.000" total is "46.000" this is what i like to display on the top of the page. therefor i have made a Snippet on the listpage:
function Snippet1(&$params)

{

// Put your code here.

global $conn;
$rs = db_query("select sum(preis) as numbers from auftraege

INNER JOIN artikel ON auftraege.produkt_kl = artikel.id",$conn);
if($data = db_fetch_numarray($rs))

{

echo $data[0]."
";
but that shows me the whole total of all prices in the table not that what i have searched.
how can i display the total of all totals from the foundet pages.
i hope i have explaindet it good enough.
thank you for suggestions
sam

samsp author 9/4/2009

hi,
is the answer to easy, or is there no solution, or ist the question not to understand? i'll try to explain one time more.
i have made a advanced serch and the result are 1553 lines ( 4 pages = 500 per page). on each i have a total field for the column "price" on the end. i like to have on the top off the listpage a totalfield that totalize all prices of the 4 pages ( or if there more pages even more).
i tried that with a codesnippet see on top, but the result are the whole prices of the database.
can somebody give a hint?
greetings
sam

J
jdu001 9/4/2009



hi,
is the answer to easy, or is there no solution, or ist the question not to understand? i'll try to explain one time more.
i have made a advanced serch and the result are 1553 lines ( 4 pages = 500 per page). on each i have a total field for the column "price" on the end. i like to have on the top off the listpage a totalfield that totalize all prices of the 4 pages ( or if there more pages even more).
i tried that with a codesnippet see on top, but the result are the whole prices of the database.
can somebody give a hint?
greetings
sam


Hello Sam,
Of course you need the same criteria from the advanced search as WHERE parameters in your select statement.
Greetings,
Jo

samsp author 9/4/2009

hello jo,
thank you for your answering. i know that. i could't belive that there is no possibility make a sum of all total fields. like records_found or something.
greetings
sam

samsp author 9/7/2009

hi to all,
is there no solution to get a totaly field on the list page from all total fields when i have mor then one page? or is the question so stupid?
greetings
sam

samsp author 9/8/2009

hi,
no answer is the best answer. do not understand whats happend.
greeting
sam