Re: error in Paginationcode(getting only First page Results)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi
 Fajar
  Thank you for u r quick response.
  The Solution Provide by u is Working

On Thu, May 22, 2008 at 4:56 PM, Fajar Dhumadi <getime2000@xxxxxxxxx> wrote:

>   Try change
>
>
> if (!(isset($pagenum)))
> {
> $pagenum =1;
> }
>
> with
>
> $pagenum = $_GET['pagenum'];
> if(empty($pagenum))
> {
> $pagenum=1;
> }
>
> Regards,
>
> Fajar Dhumadi
>
>
> malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx<malayappa%40nannacomputers.com>>
> 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]
>
>  
>



-- 
Regards
malayappa


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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux