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 :(
elseif($_GET[act]=="terbaru"){
?>
<div class="table-header">
	    DATA PESANAN TERBARU
	</div>
	<div class="row-fluid">
	<table id="myTable" class="table table-striped table-bordered table-hover">
	<thead>
	    <tr>
	    <th class="center" width="85px">No Invoice</th>
	    <th class="center" width="90px">Tanggal</th>	    
	    <th class="center" width="100px">Nama Petugas</th>
	    <th class="center" width="85px">Berat Total</th>
	    <th class="center" width="85px">Total Harga</th>
	    <th class="center" width="120px">Nama Konsultan</th>
	    <th class="center" width="150px">Nama Jalan</th>	    
	    <th class="center" width="85px">Nama Kurir</th>	    
	    <th class="center" width="100px">Status</th>
	    <th class="hidden-480 center" width="75px">Aksi</th>
	    </tr>
	</thead>
	<tbody>
	 <?php
	 	$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");
	 	$hitmax = mysql_num_rows(qry);

		while ($d = mysql_fetch_array($qry)){
		$angka = getValue("total_biaya","invoice","no_invoice='$d[no_invoice]'");
		$rp = rupiah($angka);
		$brt = getValue("total_berat","invoice","no_invoice='$d[no_invoice]'");
		$br = berat($brt);
		$petugas = getValue("nama","user","id_user='$d[no_invoice]'");
		$konsultan = getValue("nama_konsultan","konsultan","id_konsultan='$d[no_invoice]'");
		$jalan = getValue("nama_jalan","jalan","id_jalan='$d[no_invoice]'");
		$kurir = getValue("nama_kurir","kurir","id_kurir='$d[no_invoice]'");
		$tgl = getTglIndo($d[tanggal]);
		$arStt = array(
	      	'1' => "<div class='btn btn-mini btn-yellow'> Prepare <i class='icon-refresh'></i> </div>",
	      	'2' => "<div class='btn btn-mini btn-info'> On Proccess <i class='icon-gift'> </i></div>",
	      	'3' => "<div class='btn btn-mini btn-success'> Delivered <i class='icon-ok'></i> </div>",
	      	'4' => "<div class='btn btn-mini btn-danger'> Return <i class='icon-ban-circle'></i> </div>",
	      );
	      $ptA = $d['status'];
	      $stAktif = $arStt[$ptA];
	      ?>
	      <script>
			function new_win(clicked_id)
			{			
			window.open("infoinvoice.php?noinv="+clicked_id+"","mywin","width=1000,height=500,screenX=50,left=50,screenY=50,top=50,status=yes,menubar=yes");
			}
			</script>
	      <tr>
	      <?php
	      $no++;
	      echo "	      
	      <td class='center'><a href='#' id='$d[no_invoice]' onClick='new_win(this.id)'>$d[no_invoice]</a></td>
	      <td class='center'>$tgl</td>
	      <td class='center'>$d[nama]</td>
	      <td class='center'><b>$rp</b></td>
	      <td class='center'><b>$br</b></td>
	      <td class='center'>$d[nama_konsultan]</td>
	      <td class='center'>$d[nama_jalan]</td>
	      <td class='center'>$d[nama_kurir]</td>
	      <td class='center'>$stAktif</td>
	      <td class='center'>
	      	<div class='inline position-relative'>
              <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>
              <ul class='dropdown-menu dropdown-icon-only dropdown-yellow pull-right dropdown-caret dropdown-close'>                  
                  <li><a href='?page=$page&act=3&id=$d[no_invoice]' class='tooltip-success' data-rel='tooltip' data-original-title='Delivered'>
                      <span class='green'><i class='icon-refresh bigger-120'></i></span>
                      </a>
                  </li>                   
	          </ul>
	        </div></td>";
	      ?>
	     </tr>
	    <?php 
	       }
	    ?>
	</tbody>
	</table>
	</div>
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Sep 8, 2016 · 0 Suka · 0 Tidak Suka
hi Raul, saya harus tahu struktur tablenya dulu. Triknya adalah menggunakan sub query.