Try change if (!(isset($pagenum))) { $pagenum =1; } with $pagenum = $_GET['pagenum']; if(empty($pagenum)) { $pagenum=1; } Regards, Fajar Dhumadi malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx> wrote: Hi Guys We wrote code for pagination. But we are getting the results of first page only.not getting remaining pages. Here is the code our pagination code please provide some solution <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("bulksms") or die(mysql_error()); if (!(isset($pagenum))) { $pagenum =1; } $data = mysql_query("SELECT * FROM bulk_msg") or die(mysql_error()); $rows = mysql_num_rows($data); echo "number of rows are".$rows."<br>"; //This is the number of results displayed per page $page_rows = 4; //This tells us the page number of our last page $last = ceil($rows/$page_rows); echo "last page is".$last."<br>"; //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; echo "first time page no".$pgaenum."<br>"; } elseif ($pagenum > $last) { $pagenum = $last; echo "next time page no".$pgaenum."<br>"; } //This sets the range to display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; // add $max limit $data_p = mysql_query("SELECT * FROM bulk_msg $max") or die(mysql_error()); while($info = mysql_fetch_array( $data_p )) { Print $info['message']; echo "<br>"; } echo "<p>"; echo " --Page $pagenum of $last-- <p>"; // links if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> "; } // generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> "; } ?> Thanks &Regards malayappa [Non-text portions of this message have been removed]