pdheady
asked on
How to display results on multiple pages using pagination
I would like to query my database table and display results on multiple pages. For example if I have 100 rows in my result, I want to be able to set each page to show 20 rows or x-number of rows per page. I know how to loop the row results, but I dont know how to setup a pagination to click back forth between pages. How can this be programmed easily? I would also want it to say "showing results 1 - 10 of 100" etc.. with arrows to click back and forth between pages like this < 1 | 2 | 3 | 4 >
<table width="100%" bgcolor="#CCCCCC" cellspacing="1">
<tr>
<td>ID#</div></td>
<td>Trade Name</div></td>
</tr>
<?
$sql = "SELECT * from vendors";
$query = mysql_query($sql);
while ( $row = mysql_fetch_assoc($query) ) {
?>
<tr>
<td><? echo $row["vendor_id"]; ?></td>
<td><? echo $row["trade_name"]; ?></td>
</tr>
<? } ?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER