Hi all, how the sript to view like...
| From: | Hadi | Date: | Sat, 29 Nov 2003 12:30:37 +0000 |
| Subject: | Hi all, how the sript to view like... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31814@lists.php.net to get a copy of this message | ||
I have my database page look like this:
[1] [2] [3] [4] [5] [6]
the problem is when I have my database growing it will be not nice to look
at because the number will keep growing,
how to make it like this :
<<< 1 2 3 4 >>>
Thanks for the help
require("cobaconfig.php");
$numresult = mysql_query("select * from dataiklanbaris order by id desc");
$total = mysql_num_rows($numresult);
$limit = 20;
if (empty($offset)) {
$offset = 0;
}
$query = "select * from table order by id desc limit $offset, $limit";
$result = mysql_query($query);
$halaman = intval($total/$limit);
if ($jumlah%$limit) {
$page++;
}
for ($i = 1; $i<=$page; $i++) {
$newoffset=$limit*($i-1);
if ($offset != $newoffset) {
echo " [<a href=\"view.php?offset=$newoffset\">$i</a>]";
} else {
echo "[$i]";
}
}