Senin, 07 Oktober 2013

PHP Indonesia - Facebook: Ini Script phpnya apakah ada yang salah, kalo ada ...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Ini Script phpnya apakah ada yang salah, kalo ada ...
Oct 8th 2013, 04:20, by Ogi Doank

Ogi Doank 4:20am Oct 8
Ini Script phpnya apakah ada yang salah, kalo ada saya minta bantuannya
<?php
/* Koneksi database*/
include 'pages/web/paging.php'; //include pagination file

//pagination variables
$hal = (isset($_REQUEST['hal']) && !empty($_REQUEST['hal']))?$_REQUEST['hal']:1;
$per_hal = 5; //berapa banyak blok
$adjacents = 5;
$offset = ($hal - 1) * $per_hal;
$reload="?cat=gudang&page=barang";
//Cari berapa banyak jumlah data*/

$count_query = mysql_query("SELECT COUNT(data_barang.kode_barang) AS numrows,data_barang.kode_barang, data_barang.nama_barang, data_barang.jenis_barang, data_persediaan.stok_tersedia
FROM data_barang LEFT JOIN data_persediaan ON data_barang.kode_barang = data_persediaan.kode_barang");
if($count_query === FALSE) {
die(mysql_error());
}
$row = mysql_fetch_array($count_query);
$numrows = $row['numrows']; //dapatkan jumlah data

$total_hals = ceil($numrows/$per_hal);


//jalankan query menampilkan data per blok $offset dan $per_hal
$query = mysql_query("SELECT data_barang.kode_barang, data_barang.nama_barang, data_barang.jenis_barang, data_persediaan.stok_tersedia
FROM data_barang LEFT JOIN data_persediaan ON data_barang.kode_barang = data_persediaan.kode_barang GROUP BY data_barang.kode_barang LIMIT $offset,$per_hal");

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="responsive table table-striped table-bordered">
<thead>
<!-- <tr>
<td colspan="2" align="right" class="no_sort"> </td>
</tr>
<tr>
<td class="no_sort"></td>
<td class="no_sort"></td>
</tr> -->
<tr>
<td><strong>Nama Barang</strong></td>
<td><strong>Jenis Barang</strong></td>
<td><strong>Stok Tersedia</strong></td>
<td><strong>Aksi</strong></td>
</tr>
</thead>
<?php
while($result = mysql_fetch_array($query)){
?>
<tr >
<td><?php echo $result['nama_barang']; ?></td>
<td><?php echo $result['jenis_barang']; ?></td>
<td><?php echo $result['stok_tersedia']; ?></td>

<td><a href="?cat=gudang&page=barangedit&id=<?php echo sha1($result['kode_barang']); ?>"><i class="icon icon-edit"></i></a> - <a href="?cat=gudang&page=barang&del=1&id=<?php echo sha1($result['kode_barang']); ?>"><i class="icon icon-trash"></i></a></td>
</tr>
<?php
}
?>
</table>
<?php
echo paginate($reload, $hal, $total_hals, $adjacents);
?>

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar