Re: i need ur help about pagenation

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

 



Hello Kashi,

Check out this
Just put

#--------------------from here---
<?php
$page="yourpage.php";

$PageNo=$_REQUEST['PageNo'];

if(!isset($PageNo)) {                        

$PageNo = 0;

}

$eu = ($PageNo - 0); 

$limit = 15;                                

$this1 = $eu + $limit; 

$back = $eu - $limit; 

$next = $eu + $limit; 



$sql="SELECT * FROM tablename";

$result=mysql_query($sql) or die(mysql_error());

$total=mysql_num_rows($result);


$sql2="SELECT * FROM tablename limit $eu, $limit";

$result2=mysql_query($sql2) or die(mysql_error());

$count2=mysql_num_rows($result2);

if($count2>=1){

?>
#--------------------------- to here in the top of the table where your data will displayed


Display Table Data here Like

Name   | Address  | Phone
 
wihile loop { 

etc.

}

<?php
}
?>






//Paging goes here

Put below code for page navigation anywhere of your page but not before the above code.




//Anchor for previous link
                                        <?php

        if($back >=0) { 

        echo"<a href=$page?PageNo=".$back.">Previous</a>";

        }        ?>    

//Anchor for page numbers


                                        <?php

$i=0;

$l=1;

for($i=0;$i < $total;$i=$i+$limit){

if($i <> $eu){

echo "<a href=$page?PageNo=".$i.">$l</a> ";

}

else { echo "$l";}

$l=$l+1;

}

?>


//Anchor for Next

 <?php

        if($this1 < $total) { 

echo "<a href=$page?PageNo=".$next.">Next</a>";

}

?>



Regards & Thank You,


Suman K. Rai
Cell: +977 98040 25616
rai.suman@xxxxxxxxx | sumanrai1980@xxxxxxxxx
www.raisuman.myplace.com


--- On Mon, 1/26/09, kashi kashan <ksncool@xxxxxxxxx> wrote:

From: kashi kashan <ksncool@xxxxxxxxx>
Subject:  i need ur help about pagenation
To: php-objects@xxxxxxxxxxxxxxx
Date: Monday, January 26, 2009, 10:55 PM





I m beginner in php so didn¢t know the right syntax of php
and now I have a problem that I want to do pagination in my display page with using class and function. So
can any one of you help me?? rep as soon as possible.





      

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


------------------------------------

Are you looking for a PHP job? Join the PHP Professionals directory Now!
http://www.phpclasses.org/professionals/Yahoo! Groups Links






      

[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