Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ini mas. intinya main di $jumlah_page untuk nentuin start fetching bukunya
- else if((substr($doto, -1)) == 5)
- {
- $sqlpok = mysqli_query($koneksi, "SELECT COUNT(id) AS jumlah FROM data_buku2 WHERE kategori = 'komp'");
- $get_jumlah = mysqli_fetch_assoc($sqlpok);
- switch($doto){
- //=====NEXT=====
- case 'next5':
- if (($tron+9) >= ($get_jumlah['jumlah'])){
- apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di akhir halaman'));
- $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
- } else {
- $jumlah_page = $tron+9;
- }
- break;
- //=====LAST=====
- case 'last5':
- if(($tron+9) >= ($get_jumlah['jumlah'])){
- apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di akhir halaman'));
- $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
- }
- else {
- $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
- }
- break;
- //====FIRST=====
- case 'first5':
- if($tron == 1){
- apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di awal halaman'));
- $jumlah_page = 0;
- }else{
- $jumlah_page = 0;
- }
- break;
- //====PREVIOUS====
- case 'previous5':
- if($tron == 1){
- apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di awal halaman'));
- $jumlah_page = 0;
- }else{
- $jumlah_page = $tron-11;
- }
- break;
- }
- $sql = mysqli_query($koneksi, "SELECT * FROM data_buku2 WHERE kategori = 'komp' ORDER BY pengarang ASC LIMIT $jumlah_page,10");
- $isi = '';
- $noe = $jumlah_page + 1; // Untuk penomoran tabel
- while($data = mysqli_fetch_assoc($sql)){
- $isi .= $noe++.'. {'.$data['id_buku'].'} '.$data['judul_buku'].'-'.$data['pengarang'].' ('.$data['type_file'].'-'.substr($data['bahasa'],0,4).')'.chr(10);
- }
- apiRequestJson("editMessageText", array('chat_id' => $chat_id2, 'message_id' => $message_id2, 'text' => $isi,
- 'reply_markup' => array(
- 'inline_keyboard' => array(array(array("text" => "First", 'callback_data' => 'first5'),
- array("text" => "\xE2\x97\x80", 'callback_data' => 'previous5'),
- array("text" => "\xE2\x96\xB6", 'callback_data' => 'next5'),
- array("text" => "Last", 'callback_data' => 'last5'))))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement