Code Duplication    Length = 4-5 lines in 3 locations

main/survey/fillsurvey.php 2 locations

@@ 748-752 (lines=5) @@
745
                    ";
746
747
            $result = Database::query($sql);
748
            while ($row = Database :: fetch_array($result)) {
749
                $answer_list['value'] = $row['value'];
750
                $answer_list['group'] = $row['survey_group_pri'];
751
                $results[] = $answer_list;
752
            }
753
754
            //echo '<br />'; print_r($results); echo '<br />';
755
            // Get the total score for each group of questions
@@ 779-783 (lines=5) @@
776
                    ORDER BY temp.survey_group_pri";
777
778
            $result = Database::query($sql);
779
            while ($row = Database::fetch_array($result)) {
780
                $list['value'] = $row['value'];
781
                $list['group'] = $row['survey_group_pri'];
782
                $totals[] = $list;
783
            }
784
            //echo '<pre>'; print_r($totals);
785
786
            $final_results = array();

main/survey/survey.lib.php 1 location

@@ 2455-2458 (lines=4) @@
2452
                GROUP BY option_id, value";
2453
        $result = Database::query($sql);
2454
        $number_of_answers = 0;
2455
        while ($row = Database::fetch_array($result)) {
2456
            $number_of_answers += $row['total'];
2457
            $data[$row['option_id']][$row['value']] = $row;
2458
        }
2459
2460
        $chartData = array();
2461
        foreach ($options as $option) {