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/ | |
(mau nanya lag) apa yang salah yah gan. ingin mena... Aug 13th 2013, 13:58, by Indra Setiawan | (mau nanya lag) apa yang salah yah gan. ingin menampilkan gambar berdasarkan kategori menggunakan paging tapi halaman selanjutnya gambar nya ngga muncul.
<?php include "koneksi.php";
$batas=2; $halaman=$_GET['halaman']; if(empty($halaman)) { $posisi=0; $halaman=1; } else { $posisi=($halaman-1)*$batas; } // Tentukan kolom $kategori=$_GET['kategori']; $col = 3; $g = mysql_query("SELECT * FROM galeri where kategori='$kategori' LIMIT $posisi,$batas"); echo "<div><table align=center width=900><tr>"; $cnt = 0; while ($w = mysql_fetch_array($g)) { if ($cnt >= $col) { echo "</tr><tr>"; $cnt = 0; } $cnt++; echo "<td align=center><br /> <a href='../gambar/$w[gambar]' title='$w[deskripsi]' class='pirobox'> <img alt='$w[deskripsi]' width=200 height=160 src='../gambar/$w[gambar]' /></a><br /></td>"; } echo "</tr></table></div>";
echo "<br><br><center>halaman:"; $tampil2=("SELECT * FROM galeri where kategori='$kategori'"); $hasil2=mysql_query($tampil2); $jmldata=mysql_num_rows($hasil2); $jmlhalaman=ceil($jmldata/$batas); for($i=1;$i<=$jmlhalaman;$i++) if($i !=$halaman) { echo "<a href=?module=detailgaleri&halaman=$i>$i</a>|"; } else { echo "<b>$i</b>|"; } echo "<p>Jumlah Data Galeri =<b>$jmldata</b></p>"; ?> </table> </td> </tr> <br/> </body> </html> | | |
|
Tidak ada komentar:
Posting Komentar