membuat next page

Robert James M · Jan 7, 2013
mas aku punya kode seperti ini
<!DOCTYPE html> 
<html> 
<head>
<title>Next Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
<meta name="HandheldFriendly" content="true"/>
<meta name="MobileOptimized" content="320"/>
<link href="style.css" rel="stylesheet" type="text/css"/>

</head>

<body>
<div class="content">
	<div id="navButtons">
		<ul>
			<li><a href="index.html">Home</a></li>

		</ul>
	</div>

<p class="pageHead">Iklan</p>
	
<?php

  $batas	= 5;
			  
			  $halaman	= isset($_GET['halaman']) ? $_GET['halaman']:1;
				
				$posisi	= null;
				
				if(empty($halaman)){
					$posisi		= 0;
					$halaman	= 1;
				}else{
					$posisi	= ($halaman-1)* $batas;
				}

  mysql_connect   ("localhost", "root", "");
  mysql_select_db ("");
 
   if(isset($txtcari))
	{
	   $myquery="select Tipe, Nama_produk, Nama_user, Email, Tlp, format(Harga,2) as harga from iklan where Id_iklan='$txtcari' or Tipe LIKE '%$txtcari%'";
	}
	else
	{
	   $myquery="select Id_iklan, Tipe, Nama_produk, Nama_user, Email, Tlp, format(Harga,2) as harga from iklan";
	}
		$daftarsiswa=mysql_query($myquery) or die (mysql_error());
 $i = 1;
	while($hasil=mysql_fetch_object($daftarsiswa))
	{
			
              ?>
			  <div class="wrapper" style="width:32%; margin-right:1%;float:left">
											 <p class="hangingSubhead">Jenis Iklan :<?php echo $hasil->Tipe;?></p>
								              <p>Id iklan 	    :<?php echo $hasil->Id_iklan;?></p>
											  <p>Produk 	    :<?php echo $hasil->Nama_produk;?></p>
								              <p>Oleh 		    :<?php echo $hasil->Nama_user;?></p>
								              <p>Email		    :<?php echo $hasil->Email;?></p>
								              <p>Telephone 		:<?php echo $hasil->Tlp;?></p>
								              <p>Harga 	     	:Rp <?php echo $hasil->harga;?></p>
                            
				</div>
<?php
	if($i % 3 == 0){
		echo '<div style="clear:both"></div>';
	}
	$i++;
	}
?>

	<?php
	$sql_paging		= mysql_query("select Id_iklan, Tipe, Nama_produk, Nama_user, Email, Tlp, format(Harga,2) as harga from iklan");
	$jmldata		= mysql_num_rows($sql_paging);
	$jumlah_halaman	= ceil($jmldata / $batas);
	
	echo "page: ";
	
	for ($i = 1; $i <= $jumlah_halaman; $i++)
	if ($i !=$halaman) {
			echo "<a href=login.php?halaman=$i>$i</a>|";
			}else{
				echo "<b>$i</b>|";
			}
			mysql_close();
	?>



</div>
</body>
</html>

nah aku mau buat, pas dia udah 3 kebawah dan 3 kesamping itu next page gimana?

kalo kode diatas, ga berubah antara page 1 dst isinya itu saja

terima kasih
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Jan 7, 2013 · 0 Suka · 0 Tidak Suka