Mohon pencerahannya mastah.

saya punya tabel invoice (no_invoice, tanggal, total_berat, total_biaya, id_konsultan, id_kurir, status).

saya ingin menampilkan data untuk page kurir, namun data yang tampil harus mensortir coloum (total_berat) tidak boleh lebih dari 46 kg (<46).

bagaimana cara saya mensortir nya ketika data tersebut ditampilakan.

mohon sekali pencerahannya mastah :(
  1. elseif($_GET[act]=="terbaru"){
  2. ?>
  3. <div class="table-header">
  4. DATA PESANAN TERBARU
  5. </div>
  6. <div class="row-fluid">
  7. <table id="myTable" class="table table-striped table-bordered table-hover">
  8. <thead>
  9. <tr>
  10. <th class="center" width="85px">No Invoice</th>
  11. <th class="center" width="90px">Tanggal</th>
  12. <th class="center" width="100px">Nama Petugas</th>
  13. <th class="center" width="85px">Berat Total</th>
  14. <th class="center" width="85px">Total Harga</th>
  15. <th class="center" width="120px">Nama Konsultan</th>
  16. <th class="center" width="150px">Nama Jalan</th>
  17. <th class="center" width="85px">Nama Kurir</th>
  18. <th class="center" width="100px">Status</th>
  19. <th class="hidden-480 center" width="75px">Aksi</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. <?php
  24. $qry = mysql_query("SELECT a.*, b.nama_konsultan, c.nama, d.nama_jalan, e.nama_kurir FROM invoice a LEFT JOIN konsultan b ON a.id_konsultan=b.id_konsultan LEFT JOIN user c ON a.id_user=c.id_user LEFT JOIN jalan d ON a.id_jalan=d.id_jalan LEFT JOIN kurir e ON a.id_kurir=e.id_kurir WHERE a.status =1 AND a.tanggal='$now' and a.id_kurir=$uUser ORDER BY a.no_invoice ASC");
  25. $hitmax = mysql_num_rows(qry);
  26.  
  27. while ($d = mysql_fetch_array($qry)){
  28. $angka = getValue("total_biaya","invoice","no_invoice='$d[no_invoice]'");
  29. $rp = rupiah($angka);
  30. $brt = getValue("total_berat","invoice","no_invoice='$d[no_invoice]'");
  31. $br = berat($brt);
  32. $petugas = getValue("nama","user","id_user='$d[no_invoice]'");
  33. $konsultan = getValue("nama_konsultan","konsultan","id_konsultan='$d[no_invoice]'");
  34. $jalan = getValue("nama_jalan","jalan","id_jalan='$d[no_invoice]'");
  35. $kurir = getValue("nama_kurir","kurir","id_kurir='$d[no_invoice]'");
  36. $tgl = getTglIndo($d[tanggal]);
  37. $arStt = array(
  38. '1' => "<div class='btn btn-mini btn-yellow'> Prepare <i class='icon-refresh'></i> </div>",
  39. '2' => "<div class='btn btn-mini btn-info'> On Proccess <i class='icon-gift'> </i></div>",
  40. '3' => "<div class='btn btn-mini btn-success'> Delivered <i class='icon-ok'></i> </div>",
  41. '4' => "<div class='btn btn-mini btn-danger'> Return <i class='icon-ban-circle'></i> </div>",
  42. );
  43. $ptA = $d['status'];
  44. $stAktif = $arStt[$ptA];
  45. ?>
  46. <script>
  47. function new_win(clicked_id)
  48. {
  49. window.open("infoinvoice.php?noinv="+clicked_id+"","mywin","width=1000,height=500,screenX=50,left=50,screenY=50,top=50,status=yes,menubar=yes");
  50. }
  51. </script>
  52. <tr>
  53. <?php
  54. $no++;
  55. echo "
  56. <td class='center'><a href='#' id='$d[no_invoice]' onClick='new_win(this.id)'>$d[no_invoice]</a></td>
  57. <td class='center'>$tgl</td>
  58. <td class='center'>$d[nama]</td>
  59. <td class='center'><b>$rp</b></td>
  60. <td class='center'><b>$br</b></td>
  61. <td class='center'>$d[nama_konsultan]</td>
  62. <td class='center'>$d[nama_jalan]</td>
  63. <td class='center'>$d[nama_kurir]</td>
  64. <td class='center'>$stAktif</td>
  65. <td class='center'>
  66. <div class='inline position-relative'>
  67. <button class='btn btn-mini btn-primary dropdown-toggle' data-toggle='dropdown' data-rel='tooltip' data-original-title='Aksi'><i class='icon-cog icon-only bigger-110'></i></button>
  68. <ul class='dropdown-menu dropdown-icon-only dropdown-yellow pull-right dropdown-caret dropdown-close'>
  69. <li><a href='?page=$page&act=3&id=$d[no_invoice]' class='tooltip-success' data-rel='tooltip' data-original-title='Delivered'>
  70. <span class='green'><i class='icon-refresh bigger-120'></i></span>
  71. </a>
  72. </li>
  73. </ul>
  74. </div></td>";
  75. ?>
  76. </tr>
  77. <?php
  78. }
  79. ?>
  80. </tbody>
  81. </table>
  82. </div>
1468
Ellyx Christian
0
hi Raul, saya harus tahu struktur tablenya dulu. Triknya adalah menggunakan sub query.
  • Sep 8, 2016
  • 0 suka, 0 tidak suka
4950
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification
User Paling Aktif Bulan Lalu

Rey Paksi Manggala

Rey Paksi Manggala

Point Bulan Lalu: 6