Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-08-2012, 01:49 PM   PM User | #1
runeveryday
Regular Coder

 
Join Date: Jul 2009
Posts: 152
Thanks: 8
Thanked 0 Times in 0 Posts
runeveryday can only hope to improve
How to add a pager to the page with php?

I'm new to PHP and I'd like to add a pagination function to the page.

I have this piece of code:

Code:
$result = mysql_query( "select title from post LIMIT 5 OFFSET 0");
while ($row = mysql_fetch_object($result)) {
    echo $row->title;
}
$total is all the rows.

I'd like to show only five post titles per page. If I want to add a pager to this page, how do I do this? E.g: the URL is example.com/post.html.
runeveryday is offline   Reply With Quote
Old 12-08-2012, 03:23 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
This has been asked many times before if you search this forum or Google.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:27 AM.


Advertisement
Log in to turn off these ads.