[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1430
  • Last Modified:

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>
 
<? } ?>

Open in new window

0
pdheady
Asked:
pdheady
1 Solution
 
dr_dedoCommented:
u better use a tutorial than ready made solution, if you know exactly what you are doing, you can debug it easily, besides, it is an easy thing to do
have a look here
http://www.allsyntax.com/tutorials/view.php?id=23&entire=1
it is a "detailed" description
0
 
pdheadyAuthor Commented:
Just want I was looking for! Thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now