Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
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
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
Nini kode yang terakhir bang..
<pre> <?php $tes= count("select * from handover"); $data = $tes / 2; for ($data = 0; $data <= $tes; $data++ ) { echo "<table><tr><td></td></tr><table>" ?> <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 = 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 '<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> </pre>