Code Duplication    Length = 7-8 lines in 3 locations

main/survey/fillsurvey.php 1 location

@@ 614-621 (lines=8) @@
611
                    WHERE c_id = $course_id AND survey_id = '".intval($survey_invitation['survey_id'])."'
612
                    ORDER BY sort ASC";
613
            $result = Database::query($sql);
614
            while ($row = Database::fetch_array($result, 'ASSOC')) {
615
                if ($row['type'] == 'pagebreak') {
616
                    $counter++;
617
                } else {
618
                    // ids from question of the current survey
619
                    $paged_questions[$counter][] = $row['question_id'];
620
                }
621
            }
622
            $_SESSION['paged_questions'] = $paged_questions;
623
        } else {
624
            $paged_questions = $_SESSION['paged_questions'];

main/survey/preview.php 1 location

@@ 133-139 (lines=7) @@
130
		$result = Database::query($sql);
131
        $questions_exists = true;
132
        if (Database::num_rows($result)) {
133
    		while ($row = Database::fetch_array($result)) {
134
    			if ($row['type'] == 'pagebreak') {
135
    				$counter++;
136
    			} else {
137
    				$paged_questions[$counter][] = $row['question_id'];
138
    			}
139
    		}
140
        } else {
141
            $questions_exists = false;
142
        }

main/forum/forumfunction.inc.php 1 location

@@ 1821-1827 (lines=7) @@
1818
    $result = Database::query($sql);
1819
    $list = array();
1820
    $alreadyAdded = array();
1821
    while ($row = Database::fetch_array($result, 'ASSOC')) {
1822
        if (in_array($row['thread_id'], $alreadyAdded)) {
1823
            continue;
1824
        }
1825
        $list[] = $row;
1826
        $alreadyAdded[] = $row['thread_id'];
1827
    }
1828
1829
    return $list;
1830
}