\n"); opentable(); openrow(); tic("No of Questions"); /* Question ID */ closerow(); while ($cnt_rspdnts = sybase_fetch_array($query_cta)) { openrow(); tic((int) $cnt_rspdnts['COUNT(*)']); tic((int) $cnt_rspdnts); closerow(); } closetable(); $pcnt = .75 * $cnt_rspnts; print( "75% of resondents is $pcnt .\n\n"); */ $cnt_answers = "SELECT COUNT(*) FROM answers"; $query_ans=sybase_query($cnt_answers) or die ("Cannot exucute " . $cnt_answers); print( "totals number of answers = $cnt_answers .\n\n"); /* if this does not work, try it with out the group by */ $fav = "SELECT distinct a1.qnum, a2.qnum FROM answers a1, answers a2 WHERE a1.qnum <> a2.qnum and a1.resp > 6 and a2.resp > 6"; query_fav=sybase_query($fav) or die ("Cannot execute " .$fav); print("
\n"); opentable(); openrow(); tic("Favorable A"); /* Question ID */ tic("Favorable B"); closerow(); while ($fav = sybase_fetch_array($query_fav)) { openrow(); tic((int) $fav['a1.qnum']); tic((int) $fav['a2.qnum']); closerow(); } closetable(); $cnt_answers = "SELECT COUNT(*) FROM answers"; $query_ans=sybase_query($cnt_answers) or die ("Cannot exucute " . $cnt_answers); print( "totals number of answers = $cnt_answers .\n\n"); /*Count the number of times a question was responded to */ $crtview = "CREATE VIEW response(resp_cnt,q_num) AS SELECT resp_cnt = COUNT(responseid),q_num=qnum FROM answers GROUP BY qnum"; $query_view=sybase_query($crtview) or die ("Cannot execute view"); $favview = "CREATE VIEW favorite(resp_cnt,q_num) AS SELECT resp_cnt = COUNT(responseid),q_num=qnum FROM answers WHERE resp > 6 GROUP BY qnum"; $query_favview=sybase_query($favview) or die ("Cannot execute fav view"); $twoview = "CREATE VIEW twofav(resp_cnt,q1_num,q2_num) AS SELECT resp_cnt = COUNT(responseid),q1_num=a1.qnum,q2_num=a2.qnum FROM answers a1, answers a2 WHERE a1.resp > 6 and a2.resp > 6 and a1.qnum <> a2.qnum and a1.responseid = a2.responseid GROUP BY a1.qnum"; $query_twoview=sybase_query($twoview) or die ("Cannot execute two view"); $cnt_qnum = "SELECT COUNT(responseid), qnum FROM answers GROUP BY qnum"; $query_qnum=sybase_query($cnt_qnum) or die ("Cannot exucute " . $cnt_qnum); print("
\n"); opentable(); openrow(); tic("No of Responses"); /* Question ID */ tic("Question No"); closerow(); while ($cnt_qnum = sybase_fetch_array($query_qnum)) { openrow(); tic((int) $cnt_qnum['COUNT(responseid)']); tic((int) $cnt_qnum['qnum']); closerow(); } closetable(); print( "totals number of answers = $cnt_answers .\n\n");