Paging Using PHP

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

Who is Participating?
Ray PaseurConnect With a Mentor Commented:
The canonical article on "pagination" is from Sitepoint.  It's old, but it has stood the test of time.
BRMarketingAuthor Commented:
thank you Ray Paseur
Julian HansenCommented:
We also have an article here at EE that covers this topic
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

BRMarketingAuthor Commented:
Thank you Julian. I saw it yesterday after the question. It's perfect. Thank you
Sachin SinghCommented:
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.

Julian HansenCommented:
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.
BRMarketingAuthor Commented:
thank you Sachin Singh and Julian Hansen,

I will use MySqli, thank you for reminding me this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.