bagaiman Menampilkan database jika baris ke-9 maka akan pindah di sebelah kanan?

Gimana caranya membuat 2 kolom dengan menampilkan database jika baris ke-9 maka akan pindah di sebelah kanan dan dilimit 16 data saja..

berikut syntax yg sudah saya limit

<?php
 //koneksi
   include('koneksi.php');
   //proses
    if(isset($_POST['simpan'])) {
    $no_order=$_POST['no_order'];
    $awb=$_POST['awb'];

//script validasi data
    $cek = mysql_num_rows(mysql_query("SELECT * FROM handover WHERE awb='$awb'"));
    if ($cek > 0){
    echo "<script>window.alert('NO AWB SUDAH ADA')
    window.location='index.php'</script>";
    }else {
    $query= mysql_query("INSERT INTO handover values('','$no_order','$awb',now() )");
    }
    }

 ?>
 <!DOCTYPE html>
    <html>

<script>
function nextfieldBarcode(event){  // fungsi saat tombol enter
    if(event.keyCode == 13 || event.which == 13){
  document.getElementById('awb').focus();
    }
}
</script>

    <head>

    <title></title>
    </head>
    <body>
        <form  method="post" class="form-user">
           <table>
            <input  placeholder="NO ORDER" required="" type="text" name="no_order" id="no_order" onkeypress="nextfieldBarcode(event)"
autofocus />
            <input  placeholder="NO AWB" maxLength="21" required="" type="text" name="awb" id="awb"
autofocus />
            <td><input type="submit" name="simpan" value="simpan"></td>

           </table>
           </form>

<br/>
    <form method="get" action="index.php">
      <label>PILIH TANGGAL</label>
      <input type="datetime-local" name="datet">
      <input type="datetime-local" name="datet2">
      <input type="submit"name="tampilkan" value="FILTER">
    </form>
    <br/>
<form method="post" action="cari.php">
    <input type="text" name="cari" value="">
    <input type="submit"  value="ayo cari">
    </form>
     <div>

     <?php

       ?>
 <table border="1" cellpadding="8">
                  <thead>
                    <tr>
                      <th>id</th>
                      <th>no_order</th>
                      <th>awb</th>
                      <th>date&time</th>
                      <th>action</th>
                    </tr>

<?php
 $awal = 0;
 $akhir = 16;
     //https://www.kaskus.co.id/post/532f11051f0bc3241e8b4814#post532f11051f0bc3241e8b4814 // untuk pindak ke kekolom samping
      if(isset($_GET['tampilkan'])){ //untuk nampilin filter tanggal
        $start = $_GET['datet'];
        $end = $_GET['datet2'];
        $sql = mysql_query("SELECT * FROM handover WHERE datet BETWEEN '$start' AND '$end' ORDER by datet DESC LIMIT $awal, $akhir"); //"ORDER by datet DESC" agar dari terakhir jadi awal
        echo '<a href="export-excel-ship&tampilkan='.$_GET['tampilkan'].'">Cetak PDF</a><br /><br />';
      }else{

        $sql = mysql_query("select * from handover ORDER BY datet DESC LIMIT $awal, $akhir ");
      }
      while($s = mysql_fetch_array($sql)){
        $id= $s['id'];
        $no_order= $s['no_order'];
        $awb=  $s['awb'];
        $datet= $s['datet'];
  ?>
  <tr>
    <td><?php echo $id ?></td>
    <td><?php echo $no_order ?></td>
    <td><?php echo $awb ?></td>
    <td><?php echo $datet ?></td>
    <td><a href="awbedit.php?&id=<?php echo sha1($s['no_order']); ?>">Edit</a> - <a href="index.php?&del=1&id=<?php echo sha1($s['awb']); ?>">Hapus</a></td>
  </tr>
  <?php
  }
  ?>
</table>
</div>
    </body>
    </html>
     <?php
    ?>
 <?php
if(isset($_GET['del']))
{
  $ids=$_GET['id'];
  $ff=mysql_query("Delete from handover Where sha1(awb)='".$ids."'");
  if($ff)
  {
    echo "<script>window.location='index.php'</script>";
  }
}
?>

output yg diinginkan

avatar ajerbowo
@ajerbowo

5 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Tanggapan

maksudnya gimana, saya ga paham sama pertanyaan kamu..

Maksudnya bang, menampilkan data tapi disambung ke kolom 2 datanya

2 Jawaban:

<img src='https://imgur.com/S9RId0E.jpg'>

ini udah nampilin 2 tabel data, tapi datanya nggak ngelanjutin malah ngulang bang,, gimana ya ngelanjutin id yang terakhir

avatar ajerbowo
@ajerbowo

5 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Nini kode yang terakhir bang..

<pre> &lt;?php $tes= count("select * from handover"); $data = $tes / 2; for ($data = 0; $data &lt;= $tes; $data++ ) { echo "&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;table&gt;" ?&gt; &lt;table border="1" cellpadding="8"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;id&lt;/th&gt; &lt;th&gt;no_order&lt;/th&gt; &lt;th&gt;awb&lt;/th&gt; &lt;th&gt;date&time&lt;/th&gt; &lt;th&gt;action&lt;/th&gt; &lt;/tr&gt; &lt;?php $awal = 0; $akhir = 12; //https://www.kaskus.co.id/post/532f11051f0bc3241e8b4814#post532f11051f0bc3241e8b4814 // untuk pindak ke kekolom samping if(isset($_GET['tampilkan'])){ //untuk nampilin filter tanggal $start = $_GET['datet']; $end = $_GET['datet2']; $sql = mysql_query("SELECT * FROM handover WHERE datet BETWEEN '$start' AND '$end' ORDER by datet DESC LIMIT $awal, $akhir"); //"ORDER by datet DESC" agar dari terakhir jadi awal echo '&lt;a href="export-excel-ship&tampilkan='.$_GET['tampilkan'].'"&gt;Cetak PDF&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;'; }else{

    $sql = mysql_query(&quot;select * from handover ORDER BY datet DESC LIMIT $awal, $akhir &quot;);
  }
  while($s = mysql_fetch_array($sql)){ 
    $id= $s[&#039;id&#039;];
    $no_order= $s[&#039;no_order&#039;]; 
    $awb=  $s[&#039;awb&#039;]; 
    $datet= $s[&#039;datet&#039;];      

?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $id ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $no_order ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $awb ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $datet ?&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="awbedit.php?&id=&lt;?php echo sha1($s['no_order']); ?&gt;"&gt;Edit&lt;/a&gt; - &lt;a href="index.php?&del=1&id=&lt;?php echo sha1($s['awb']); ?&gt;"&gt;Hapus&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } } ?&gt; &lt;/table&gt; </pre>

avatar ajerbowo
@ajerbowo

5 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban