Help - Search - Members - Calendar
Full Version: Just a Sum... ^^
Big Red Spark Forums > Big Red Spark.com Forums > Unit Command Climate Assessment and Survey System (UCCASS)
killer_
First i have to say...this is the best software for survey....this help me so many times in my work
Congratulations Johns .... ^.^

i make some modifications on SELECT (retrieve answers to questions) on class “results.class.php”...all fine....but now i want to know, if possible, how can i sum and show the Total....
It's dificult to explain but i want some thing like this....

IPB Image


I know....i know....have one “Total Answer” but when i use my kind of SELECT some answered surveys are “omited”....and the Total show me all the answers... i want only the Total results for my SELECT, not all answer.....
JHolmes763
What kind of modifications did you make? The total should just count up how many rows were returned for each question ID.
killer_
QUOTE(JHolmes763 @ Oct 1 2007, 09:36 PM) *

What kind of modifications did you make? The total should just count up how many rows were returned for each question ID.


i add some column to table results and change the SELECT.....

SELECT r.qid, r.avid, count(*) AS c FROM {$this->CONF['db_tbl_prefix']}results r,
{$this->CONF['db_tbl_prefix']}answer_values av,
{$this->CONF['db_tbl_prefix']}questions q, site.contact
WHERE r.qid = q.qid and r.sid = $sid and r.avid = av.avid and contact.status = 1 and
r.status = contact.status $hide_show_where
{$_SESSION['filter'][$sid]}
GROUP BY r.qid, r.avid
ORDER BY r.avid ASC

QUOTE
The total should just count up how many rows were returned for each question ID.


but it returns all the answers for each question....ignoring my select

the {$count[qid][a]}....OK for each row
but {$num_answers[qid]} return all

how can i sum using {$count[qid][a]}?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.