Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. //ini mas. intinya main di $jumlah_page untuk nentuin start fetching bukunya
  2.  
  3. else if((substr($doto, -1)) == 5)
  4. {
  5. $sqlpok = mysqli_query($koneksi, "SELECT COUNT(id) AS jumlah FROM data_buku2 WHERE kategori = 'komp'");
  6. $get_jumlah = mysqli_fetch_assoc($sqlpok);
  7.  
  8. switch($doto){
  9. //=====NEXT=====
  10. case 'next5':
  11. if (($tron+9) >= ($get_jumlah['jumlah'])){
  12. apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di akhir halaman'));
  13. $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
  14. } else {
  15. $jumlah_page = $tron+9;
  16. }
  17. break;
  18. //=====LAST=====
  19. case 'last5':
  20. if(($tron+9) >= ($get_jumlah['jumlah'])){
  21. apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di akhir halaman'));
  22. $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
  23. }
  24. else {
  25. $jumlah_page = (floor($get_jumlah['jumlah'] / 10)) * 10;
  26. }
  27. break;
  28. //====FIRST=====
  29. case 'first5':
  30. if($tron == 1){
  31. apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di awal halaman'));
  32. $jumlah_page = 0;
  33. }else{
  34. $jumlah_page = 0;
  35. }
  36. break;
  37. //====PREVIOUS====
  38. case 'previous5':
  39. if($tron == 1){
  40. apiRequest("AnswerCallbackQuery", array('callback_query_id' => $lost, 'text' => 'kamu berada di awal halaman'));
  41. $jumlah_page = 0;
  42. }else{
  43. $jumlah_page = $tron-11;
  44. }
  45. break;
  46. }
  47.  
  48. $sql = mysqli_query($koneksi, "SELECT * FROM data_buku2 WHERE kategori = 'komp' ORDER BY pengarang ASC LIMIT $jumlah_page,10");
  49. $isi = '';
  50. $noe = $jumlah_page + 1; // Untuk penomoran tabel
  51. while($data = mysqli_fetch_assoc($sql)){
  52. $isi .= $noe++.'. {'.$data['id_buku'].'} '.$data['judul_buku'].'-'.$data['pengarang'].' ('.$data['type_file'].'-'.substr($data['bahasa'],0,4).')'.chr(10);
  53. }
  54.  
  55. apiRequestJson("editMessageText", array('chat_id' => $chat_id2, 'message_id' => $message_id2, 'text' => $isi,
  56. 'reply_markup' => array(
  57. 'inline_keyboard' => array(array(array("text" => "First", 'callback_data' => 'first5'),
  58. array("text" => "\xE2\x97\x80", 'callback_data' => 'previous5'),
  59. array("text" => "\xE2\x96\xB6", 'callback_data' => 'next5'),
  60. array("text" => "Last", 'callback_data' => 'last5'))))));
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement