Paging Using PHP

Posted on 2016-11-24
1 Endorsement
Last Modified: 2016-11-25
Dear experts, I use below code to print out every row in table.
But there are many rows that can not fit in a page.

what I want to do is to list every 100 row in the first page and give "next 100" link for the other 100 so on...
I see it on blog pages.

I want to show query result in multiple pages instead of just put them all in one long page.

How can I do this with php?

My code is:

$sql9 = "SELECT * FROM xxxxxxx";
$result9 = $conn->query($sql9);

      while($row9 = $result9->fetch_assoc()) {
	$id= $row9["id"];
	$kategori= $row9["kategori"];
	$sehir= $row9["sehir"];

echo "<table class=ab width=990px; style=max-width=990px;>
  <td><span class=yazibaslik>İlan Başığı: $id </span></td>
  <td><span class=yazibaslik>Şehir: $sehir</span></td>
  <td><span class=yazibaslik>Kategori: $kategori </span></td>


Open in new window

Question by:Braveheartli
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 110

Accepted Solution

Ray Paseur earned 500 total points
ID: 41900576
The canonical article on "pagination" is from Sitepoint.  It's old, but it has stood the test of time.

Author Closing Comment

ID: 41900579
thank you Ray Paseur
LVL 57

Expert Comment

by:Julian Hansen
ID: 41901245
We also have an article here at EE that covers this topic
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 41901247
Thank you Julian. I saw it yesterday after the question. It's perfect. Thank you

Expert Comment

by:Sachin Singh
ID: 41901434
Paging means showing your query result in multiple pages instead of just put them all in one long page.Check this helpful link i hope it will help you.

LVL 57

Expert Comment

by:Julian Hansen
ID: 41901446
Please note the links posted above both refer to samples that make use of the deprecated MySQL library. You should not consider using any code that is still dependent on this library. If you do decide to use the code you should convert it to use MySQLi.

Author Comment

ID: 41901450
thank you Sachin Singh and Julian Hansen,

I will use MySqli, thank you for reminding me this.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question