I'm looking for a piece of code to make a "prev|next" item out of searchresults.
(i.e: so i can display 10 out of 60 results and then click on 'next' to see the next 10 results etc. etc.)
Does anyone has such a piece of code or is there a tutorial about it?
Oeps, sorry. (can i cancel the post?)
I saw later that Kevin Yank (is it.... yes, it's THE Kevin Yank. The man who knows almost everything about php. ;-)
posted an answer on such a question on the 5th of August. Let's take a look at that article. www.webmasterbase.com
Uhh, another reply on my reply...
I read the article about the LIMIT statement but can't figure out the rest.
----------article from site----------
You can use a LIMIT clause to do this sort of thing by specifying both the result to begin the list with and the maximum number of results to display. The following query, for example, will list the 21st to 25th most popular jokes in the database
The question is how i can make that 'following query' (using next|prev ?, how)
Create a counter variable and keep passing it to the next.
For instance lets say you list 10 results per page, well on the first page create a variable named "counter" and give it a value of 10 and then use that in your limit clause.
Then do some math functions, Counter+10=Next Counter-10=Prev
Then pass a variable with your links.
Use some if then else statements to insure you dont go lower than 0 or over the total # of results returned, and you should be in business.
Joep, could you give the exact URL to Kevin's article (Where LIMIT is being discussed). I find this very interesting.