[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

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;>
<tr>
  <td><span class=yazibaslik>İlan Başığı: $id </span></td>
</tr>
<tr>
  <td><span class=yazibaslik>Şehir: $sehir</span></td>
</tr>
<tr>
  <td><span class=yazibaslik>Kategori: $kategori </span></td>
</tr>

</table>";
}

Open in new window

1
Braveheartli
Asked:
Braveheartli
1 Solution
 
Ray PaseurCommented:
The canonical article on "pagination" is from Sitepoint.  It's old, but it has stood the test of time.
https://www.sitepoint.com/perfect-php-pagination/
0
 
BraveheartliMarketingAuthor Commented:
thank you Ray Paseur
0
 
Julian HansenCommented:
We also have an article here at EE that covers this topic
https://www.experts-exchange.com/articles/12238/Pagination-with-PHP-and-Mysql.html
1
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!

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

https://www.mindstick.com/blog/265/pagination-in-php

http://www.freezecoders.com/2014/01/simple-pagination-using-php-mysql.html

Thanks
1
 
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.
1
 
BraveheartliMarketingAuthor Commented:
thank you Sachin Singh and Julian Hansen,

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

Featured Post

Industry Leaders: 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!

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