coba coding sederhana seperti ini...

<?php

$limit = 5; // menampilkan 5 record perhalaman, bisa diubah sesuai jumlah 
record yang tampil per halaman

$pre_result = "";
$post_result = "";
$post_nav = "";

if (!isset($_REQUEST['hal'])){
    $hal = 1;
    $start_no = 0;
}
else {
    $hal = $_REQUEST['hal'];
    $start_no = ($hal*$limit)-$limit
}

$result = mysql_query("SELECT * FROM table ORDER BY id LIMIT $start_no,$limit") 
or die(mysql_error())
$num_rows = mysql_num_rows($result);
echo $pre_result;

if ($num_rows){
    while ($rows = mysql_fetch_array($result)){
        echo $rows["column1"]."<br />".$rows["column2"]."...";
    }
}
echo $post_result;

$total_result = mysql_result(mysql_query("SELECT COUNT(id) FROM table"),0);
$total_hal = ceil($total_result/$limit);

if ($total_hal == 0){
    $total_hal = 1;
}

if ($total_result == 0){
    echo "";
}
else {
    if ($page == 1){
        $first = 1;
        $prev = $hal - 1;
        echo "<a href=\"".$_SERVER['PHP_SELF']."?hal=".$first."\">First</a>";
        echo "&nbsp";
        echo "<a href=\"".$_SERVER['PHP_SELF']."?hal=".$prev."\">Previous</a>";
    }
    for ($i=1;$i<=total_hal;$i++){
        if($hal == $i){
            echo $i;
        }
        else {
            echo "<a href=\"".$_SERVER['PHP_SELF']."?hal=".$i."\">".$i."</a>";
        }
    }
    
    if ($page < $total_hal){
        $last = $total_hal;
        $next = $hal+1;
        echo "<a href=\"".$_SERVER['PHP_SELF']."?hal=".$next."\">Next</a>";
        echo "&nbsp";
        echo "<a href=\"".$_SERVER['PHP_SELF']."?hal=".$last."\">Last</a>";
    }
}

?>

----- Original Message ----
From: edi setiadi <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, 3 May, 2006 6:59:38 PM
Subject: [toekangweb] Minta Bantuan Buat Nomor Halaman PHP

Para senior....ada yang tahu kode PHP untuk halaman secara otomatis
sesuai jumlah database?

Misalnya dalam satu tampilan terdapat 15 material, maka akan dibuatkan
link halaman 1,2,3... sesuai dengan jumlah databsenya dan diujung2
nomor itu ada Next dan Previous


Matur Nuhun





--- 
Website: http://toekangweb.or.id/
Arsip milis : http://groups.yahoo.com/group/toekangweb/messages
 
Yahoo! Groups Links



 







[Non-text portions of this message have been removed]



--- 
Website: http://toekangweb.or.id/
Arsip milis : http://groups.yahoo.com/group/toekangweb/messages
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/toekangweb/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke