PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 18th, 2002, 01:15 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Next and Previous LInks

Hi Guys,

I have a PHP guestbook and all the posts to my guestbook are posted in one page, so How can I make let's say 10 posts per page?

I took the guestbook php script from:

http://www.developers-resources.com/stories.php?story=01/11/22/0455791

Please feed me back

HaVe a GooD DaY ;)

Ali

ali_alsaffar@hotmail.com

Reply With Quote
  #2  
Old August 18th, 2002, 04:07 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Next and Previous LInks

give this one a shot

http://codewalkers.com/tutorials.php?show=4

worked for me ;)

Reply With Quote
  #3  
Old August 19th, 2002, 11:41 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: Next and Previous LInks

I have found a little problem with my prev and next links, for some reason it counts the amount of rows in the table and not the rows being displayed, is there anyways of correcting this? also having a displaying 15 of 25 reviews in A etc?

Reply With Quote
  #4  
Old August 20th, 2002, 12:43 AM
bakertrg's Avatar
bakertrg bakertrg is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Scottsdale AZ, US
Posts: 2,253 bakertrg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 45 sec
Reputation Power: 4
Send a message via Yahoo to bakertrg
RE: Next and Previous LInks

You need to use a LIMIT statement in your SQL. There is a function in PHP that is supposed to let you get the number of rows that would have been returned without the LIMIT but it frequently returns an error.

do this:
php Code:
Original - php Code
  1.  
  2. $sql = "SELECT * FROM guests";
  3. $sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.")
  4. $entries = mysql_num_row($sql_result);
  5. mysql_free_result($sql_result)

this gives you the total number of records.
Then do this:
php Code:
Original - php Code
  1.  
  2. "SELECT * FROM guests LIMIT $start, 10"

note: $start must have a value of zero on the first page and after that you add x per page (in this case 10).

B

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Next and Previous LInks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway