Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2004, 01:09 PM
WebProWorld Pro
 

Join Date: Aug 2004
Location: Maryland
Posts: 219
webmasterjunkie RepRank 0
Default PHP Paginating

OK, I have come up with a way to rank the pages in my searchable website.
User types in a search query and hits search. They go the to search results page and all of the pages that match that search are displayed as php links to another page that stores the term and page that the user clicked. Every so often I will evaluate the "votes" that are cast and make them more relevant results.

Problem now is paginating my results. I have googled myself to death trying to get some help on this. Tried many different codings and still no help.
Here's the part where some help would be nice. I am going to offer sposored results to my search results page based on the query. If someone can help me paginate my results I would be more than willing to give them free sponsorship.

To view the search got to http://www.homesearch-md.com
Reply With Quote
  #2 (permalink)  
Old 12-09-2004, 03:10 PM
WebProWorld Pro
 

Join Date: May 2004
Location: Austin, TX
Posts: 199
steve0 RepRank 0
Default

At the end of your search query.. use 'limit' and 'offset' to break your results into chunks for each page..
__________________
Hardcore Programming Solutions and Coffee Drinker
Reply With Quote
  #3 (permalink)  
Old 12-15-2004, 01:52 PM
WebProWorld New Member
 

Join Date: Dec 2004
Posts: 1
Downright RepRank 0
Default Re: PHP Paginating

If you are not working with a lot of data you can simply do below:

You have a dropdown box to select amount of results per page OR you have a set amount. We'll call this $aResults.

select count(*) from $table $where;

Then take the result and divide it by $aResults;

$pages = $count / $aResults;

Will give you x number of pages.

From here store what page you are in a hidden text box. And if search or amount of results change then change page # back to 1.

$DB_startRes = $pageOn * $aResults;
select * from $table $where limit $DB_startRes, $aResults;

So if you were on page 5 showing 10 results per page then this would give you results from 50-60. Then at the bottom you can do << < 5,6,7,8,9 > >> as links that just simply pass the page #. This should work to your hearts desire.

Sorry, if it isn't very clear. Please feel free to email me and I can explain better.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0