limit

Robert James M · Nov 11, 2012
mas aku bikin seperti ini
<form name="FLaporan" method="post" action="delete-banyak.php" onSubmit="return confirm('Hapus data terpilih?')">

        <table class="table" cellspacing="0" width="100%">

            <thead>

                <tr>
                    
					<th scope="col" style="text-align:center;">No</th>
					<th align="center">&nbsp;</th>
					<th scope="col" style="text-align:center;">Code of Transaction</th>
                    <th scope="col" style="text-align:center;">Mitra Name</th>
                    <th scope="col" style="text-align:center;">Address</th>
                    <th scope="col" style="text-align:center;">Building</th>
                    <th scope="col" style="text-align:center;">Address of Building</th>
                    <th scope="col" style="text-align:center;">Number of Vechile</th>
                    <th scope="col" style="text-align:center;" class="table-actions">Actions</th>
           
                    

                </tr>

            </thead>
              <?php
			  
			  $batas	= 5;
			  
			  $halaman	= $_GET['halaman'];
				
				$posisi	= null;
				
				if(empty($halaman)){
					$posisi		= 0;
					$halaman	= 1;
				}else{
					$posisi	= ($halaman-1)* $batas;
				}
			  
			  
              mysql_connect   ("localhost", "", "");
              mysql_select_db ("");
              
				
				$query		= "SELECT * FROM parkir LIMIT $posisi, $batas";
				$result		= mysql_query($query) or die ('error');
				$no			= 1;
				
			  while ($data  = mysql_fetch_array($result)){
    
?>
      
    <tbody>
	<td><?php echo  $no ?> </td>
    <td align="center">       
    <input type="checkbox" name="item[]" id="item[]" value="<?php echo $data->tagihan_nomor?>" /></td>
    <td><?php echo  $data['tagihan_nomor']; ?> </td>
    <td><?php echo  $data['nama_mitra']; ?> </td>
    <td><?php echo  $data['alamat']; ?></td>
    <td><?php echo  $data['lokasi']; ?> </td>
    <td><?php echo  $data['alamat_lokasi']; ?> </td>
    <td><?php echo  $data['nomor_polisi']; ?></td>
    <td class="table-actions">
		  <a href="http://localhost/ABMS/parking_process_result.php?kode=<?php echo $data['tagihan_nomor']?>" title="Transaction" class="with-tip"><img src="images/icons/fugue/pencil.png" width="16" height="16"></a>
	  </td>
    
  </tr>
  
<?php
	$no++;
	}
?>
</table>

	<?php
	$sql_paging		= mysql_query("SELECT tagihan_nomor from parkir");
	$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=parking_process.php?halaman=$i>$i</a>|";
			}else{
				echo "<b>$i</b>|";
			}
			mysql_close();
	?>
	
    
  
  </a></p>
</form>

nah kan pas dijalankan muncul tuh dibawahnya page 1 | 2 | 3, cuma pas baru masuk muncul error seperti ini

Notice: Undefined index: halaman in C:\xampp\htdocs\ABMS\parking_process.php on line 249

tapi pas dijalankan, artinya ke halaman 2 atau 3 dan kemudian kembali ke halaman 1 itu tidak muncul error seperti sebelumnya, itu kenapa ya?

terima kasih
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Nov 13, 2012 · 0 Suka · 0 Tidak Suka
tinggal ganti bagian:

$halaman = $_GET;

jadi

$halaman = isset($_GET) ? $_GET : 1;
0
Loading...
Robert James M · Nov 13, 2012 · 0 Suka · 0 Tidak Suka
sudah bisa mas, makasih sebelumnya