This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('database/connect.php'); | |
//print_r($db_qltc); | |
/** | |
* BÀI TOÁN PHÂN TRANG | |
* B1: Khai báo $limit_per_page (Số bản ghi trên trang) | |
* B2: Lấy $current_page (Trang hiện tại): $current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1; | |
* B3: Tính $offset = ($current_page - 1) * $limit; | |
* B4: Đếm tổng số bản ghi (Có kèm điều kiện hoặc không có điều kiện): $totalRecord | |
* B5: Tính $totalPage = ceil($totalRecord/$limit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$answers = [ | |
['question_id' => 1, 'option' => 'C'], | |
['question_id' => 2, 'option' => 'A'], | |
['question_id' => 3, 'option' => 'C'], | |
['question_id' => 4, 'option' => 'B'], | |
['question_id' => 5, 'option' => 'C'], | |
['question_id' => 6, 'option' => 'C'], | |
['question_id' => 7, 'option' => 'D'], | |
['question_id' => 8, 'option' => 'D'] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_GET['submit']) { | |
//do SMT | |
} | |
?> |
NewerOlder