i have tried to make my result page divided into pages,each pages consist 5 output here's the code:
<?
require("dbik.inc");
mysql_connect(localhost,$user,$pass);
//pilih database
@mysql_select_db("$db")or die("nggak bisa pilih database");
//nama tabel yang akan dimasukkan datanya

$query="select * from data1 ORDER BY id desc";
$result=mysql_query($query);
mysql_close();
//tampillkan hasilnya

//kodelain untuk page lister
$per_page = 5;

// You will need to change this. This should be your normal SQL query that
// you use to get the info to be displayed from the db.
$sql_text = ("SELECT * from data1 order by id desc");


// Set page #, if no page isspecified, assume page 1
// if (isset($page)) {
// $page = 1;
if ($result) {
$page = 1;
}
$prev_page = $page - 1;
$next_page = $page + 1;

$query=mysql_query($sql_text);

// Set up specified page
$page_start = ($per_page * $page) - $per_page;
$num_rows =mysql_numrows($query);

if ($num_rows <= $per_page) {
$num_pages = 1;
} else if (($num_rows % $per_page) == 0) {
$num_pages = ($num_rows / $per_page);
} else {
$num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;

if (($page > $num_pages) &#0124; &#0124; ($page < 0)) {
error("You have specified an invalid page number");
}

//
// Now the pages are set right, we can
// perform the actual displaying...
$sql_text = $sql_text . " LIMIT $page_start, $per_page";
$query = mysql_query($sql_text);
//end of kode lain untuk page lister

$i=0;
while($i<$num){
$nama=mysql_result($result,$i,"nama");
$email=mysql_result($result,$i,"email");
$city=mysql_result($result,$i,"city");
$password=mysql_result($result,$i,"password");
$headline=mysql_result($result,$i,"headline");
$isi=mysql_result($result,$i,"isi");
$url=mysql_result($result,$i,"url");
$id=mysql_result($result,$i,"id");
$pasang=time("j- m- Y");
//format hasilnya

echo"<center>";


echo"<table border=0 width=640>";
echo"<tr><td width="100%"><table border="0" width="100%" bgcolor="#3399FF">";
echo"<tr><td width="43%" bgcolor="#ddeeee">ID#:$id-<b>$headline</b></td>";
echo"<td width="57%" bgcolor="#FFFFFF">submit by<i> $nama</i></td>";
echo"</tr><tr><td width="100%" colspan="2" bgcolor="#FFFFFF"><b>Deskripsi:</b>";
echo"<br>$isi</td></tr>";
echo"<tr><td width="70%" bgcolor="#CCFFCC">[$email] -[<a href="$url">homepage</a>]</td>";
echo"<td width="30%" bgcolor="#CCFFCC">";
echo"<p align="right">post date : $pasang</td>";
echo"</tr></table>";
echo"</td></tr></table>";
echo"</center>";
++$i;
}

//kode next dan previousnya

// You will probably want to modify this stuff too. This displays
// the previous, next, and direct links to each page. It is laid out
// VERY plain below, so you will likely want to change it to fit the
// layour of your site.

// Previous
if ($prev_page) {
echo "<a href="$PHP_SELF?page=$prev_page">Prev</a> ";
}

// Page # direct links
// If you don't want direct links to each page, you should be able to
// safely remove this chunk.
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo "<a href="$PHP_SELF?page=$i">$i</a>";
} else {
echo " $i ";
}
}

// Next
if ($page != $num_pages) {
echo "<a href="$PHP_SELF?page=$next_page">Next</a>";
}

//end of kode next danprviousnya
?>

but error still showup,can you help me whats wrong?


------------------
great hope of palembang ,indonesia