Guest User

Untitled

a guest
Aug 27th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. function filter_table($kota,$usia,$profesi,$jeniskelamin){
  2. if ($kota == 'semuakota' && $usia == 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi == 'semuaprofesi') {
  3. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id group by tbl_choice.pilihan order by Jumlah desc";
  4. $result = $this->mysqli->query($query);
  5. }
  6.  
  7. else if ($kota != 'semuakota' && $usia != 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  8. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and usia = '$usia' and jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  9. $result = $this->mysqli->query($query);
  10. }
  11.  
  12. else if ($kota != 'semuakota' && $usia != 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  13. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and usia = '$usia' and profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  14. $result = $this->mysqli->query($query);
  15. }
  16.  
  17. else if ($kota != 'semuakota' && $usia == 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  18. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and profesi = '$profesi' and jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  19. $result = $this->mysqli->query($query);
  20. }
  21.  
  22. else if ($kota == 'semuakota' && $usia != 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  23. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where usia = '$usia' and profesi = '$profesi' and jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  24. $result = $this->mysqli->query($query);
  25. }
  26.  
  27. else if ($kota == 'semuakota' && $usia == 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  28. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  29. $result = $this->mysqli->query($query);
  30. }
  31.  
  32. else if ($kota == 'semuakota' && $usia == 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  33. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  34. $result = $this->mysqli->query($query);
  35. }
  36.  
  37. else if ($kota == 'semuakota' && $usia != 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  38. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where usia = '$usia' group by tbl_choice.pilihan order by Jumlah desc";
  39. $result = $this->mysqli->query($query);
  40. }
  41.  
  42. else if ($kota != 'semuakota' && $usia == 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  43. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' group by tbl_choice.pilihan order by Jumlah desc";
  44. $result = $this->mysqli->query($query);
  45. }
  46.  
  47. else if ($kota != 'semuakota' && $usia != 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  48. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and usia = '$usia' group by tbl_choice.pilihan order by Jumlah desc";
  49. $result = $this->mysqli->query($query);
  50. }
  51.  
  52. else if ($kota == 'semuakota' && $usia == 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  53. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where jk = '$jeniskelamin' and profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  54. $result = $this->mysqli->query($query);
  55. }
  56.  
  57. else if ($kota == 'semuakota' && $usia != 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  58. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where usia = '$usia' and profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  59. $result = $this->mysqli->query($query);
  60. }
  61.  
  62. else if ($kota != 'semuakota' && $usia == 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  63. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  64. $result = $this->mysqli->query($query);
  65. }
  66.  
  67. else if ($kota != 'semuakota' && $usia == 'semuausia' && $jeniskelamin == 'semuajeniskelamin' && $profesi != 'semuaprofesi'){
  68. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  69. $result = $this->mysqli->query($query);
  70. }
  71.  
  72. else if ($kota == 'semuakota' && $usia != 'semuausia' && $jeniskelamin != 'semuajeniskelamin' && $profesi == 'semuaprofesi'){
  73. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where usia = '$usia' and jk = '$jeniskelamin' group by tbl_choice.pilihan order by Jumlah desc";
  74. $result = $this->mysqli->query($query);
  75. }
  76.  
  77. else {
  78. $query = "SELECT tbl_polling.image as Gambar, tbl_polling.nama as Nama , count(*) as Jumlah from tbl_choice inner join tbl_polling on tbl_choice.pilihan=tbl_polling.id where kota = '$kota' and usia = '$usia' and jk = '$jeniskelamin' and profesi = '$profesi' group by tbl_choice.pilihan order by Jumlah desc";
  79. $result = $this->mysqli->query($query);
  80. }
  81. return $result;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment