}
} elseif ($lesson->nextpagedefault == LESSON_UNANSWEREDPAGE) {
foreach ($allpages as $thispage) {
- $params = array('pageid'=>$thispage->id,
- 'userid'=>$USER->id, 'correct'=>1, 'retry'=>$nretakes);
- if (!count_records_select("lesson_attempts", "pageid = :pageid AND
- userid = :userid AND correct = 1 AND retry = :retry", $params)) {
+ if (!$DB->count_records("lesson_attempts", array('pageid'=>$thispage->id,
+ 'userid'=>$USER->id, 'correct'=>1, 'retry'=>$nretakes))) {
$found = true;
break;
}