Skip to content

Instantly share code, notes, and snippets.

View gianghl1983's full-sized avatar

Giang Le gianghl1983

View GitHub Profile
<?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)
$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']
];
@gianghl1983
gianghl1983 / log.php
Created May 20, 2018 12:36
Kiểm tra người dùng đã đăng nhập chưa
<?php
if ($_GET['submit']) {
//do SMT
}
?>