$page = 0; if (!empty($_GET['page'])) { $page = $_GET['page']; } $dbo = new DBO($servername, $username, $password, $dbname); $sql = "SELECT * FROM questions"; $dbo->query($sql) or die($dbo->ShowError()); $num_questions = $dbo->emaitza_kopurua(); $sql = "SELECT * FROM questions LIMIT " . $page . ", 1"; $dbo->query($sql) or die($dbo->ShowError()); while ($questionDB = $dbo->emaitza()) { $question = new question($questionDB); $total++; $qid = 'q' . $question->getId(); $answer = $_POST[$qid]; $passed = $question->isCorrect($answer); // if ($passed) { // $corrects++; // } $myTC = new MyTinCanAPI(); $myTC->createObject($question->getBefore()); $myTC->createActivityType($question); $myTC->createVerb($passed); if (is_array($answer)) { $answer = implode(',', $answer); } $myTC->createResult($passed, $answer); $myTC->sendStatement(); } if ($corrects > 0 && $total > 0) { $scaled = $corrects / $total;