Code Duplication    Length = 4-5 lines in 3 locations

main/survey/fillsurvey.php 2 locations

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

main/survey/survey.lib.php 1 location

@@ 2405-2408 (lines=4) @@
2402
                GROUP BY option_id, value";
2403
        $result = Database::query($sql);
2404
        $number_of_answers = 0;
2405
        while ($row = Database::fetch_array($result)) {
2406
            $number_of_answers += $row['total'];
2407
            $data[$row['option_id']][$row['value']] = $row;
2408
        }
2409
2410
        $chartData = array();
2411
        foreach ($options as $option) {