Login   Register  
PHP Classes
elePHPant
Icontem

php pagination

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Pagination  >  All threads  >  php pagination  >  (Un) Subscribe thread alerts  
Subject:php pagination
Summary:help
Messages:2
Author:tariqshah
Date:2012-10-01 10:15:22
Update:2012-10-01 15:44:38
 

  1. php pagination   Reply   Report abuse  
Picture of tariqshah
tariqshah
2012-10-01 10:15:22
please u need to implement this pagination with some example and table also , i m unable to implement it please help me :(
thanks
here is my code
<?php $query = mysql_query("SELECT * FROM emails order by id ASC LIMIT");?> <?php echo $p->getMySqlLimitStart(); ?> , <?php echo $p->getMySqlLimitEnd();
while($rec = mysql_fetch_array($query)){
echo $rec['email'];
};
?>

  2. Re: php pagination   Reply   Report abuse  
Picture of Radovan Janjic
Radovan Janjic
2012-10-01 15:44:38 - In reply to message 1 from tariqshah
<?php

$p = new pagination;

// pagination left from current
$p->paginationLeft = 4;

// pagination right from current
$p->paginationRight = 4;

// link href
$p->path = '?page=[pageno]';

$p->setCount(mysql_result(mysql_query("SELECT COUNT(*) FROM emails"), 0));

// current page
if(isset($_GET['page'])){
$p->setStart($_GET['page']);
}



$query = mysql_query("SELECT * FROM emails ORDER BY id ASC LIMIT ".$p->getMySqlLimitStart().", ".$p->getMySqlLimitEnd());
?>

<table>
<?php
while($rec = mysql_fetch_array($query)){
echo '<tr><td>', $rec['email'], '</td></tr>';
};
?>
</table>

<?php

echo $p->display();

/*

Try this if you have more questions, please ask. ;)

*/
?>