View Full Version : pagination and anchors

12-04-2008, 09:39 AM
in m website I use the default dreamweaver php scripts to retrieve some data from my database and show them in several result pages (pagination).

There are some links pointing to these results and what I want to do is to set an anchor link to each result, and be able to direct the browser to the exact page that this result exists.

For example lets say there are 5 pages of results, and each page contains 3 results. Each result has an anchor named by its database id. <a name="<?php echo results['id']; ?>"></a>.
What do I have to do to be able to find in which page the result really exists? How am I supposed to create dynamically the right url address with the right query string?

12-04-2008, 02:04 PM
I'm not sure if I'm understanding it correctly or not ...

You're doing a search of a database and displaying results, and you know the ID of each item.

I don't know why you are using anchors ... wouldn't clicking on one of the links
open-up that article or "find" on a page all by itself?

Example, the search might yield 10 results. You could display a portion of
each result and a "read more ..." link to display the whole article.

This is article one ... blah blah blah
<a href="full_article.php?id=12345">read more ...</a><br /><br />

This is article two ... blah blah blah
<a href="full_article.php?id=23423">read more ...</a><br /><br />

This is article three ... blah blah blah
<a href="full_article.php?id=54321">read more ...</a><br /><br />

Clicking on any of those 3 "finds" will run the script called "full_article.php" that
opens the appropriate ID on it's own page.

The point of my answer is ...
You are searching a database, not a bunch of static web pages.
You don't need to know which page it's on. You can dynamically create a page
for each article in the database.

12-04-2008, 02:04 PM
http://www.codingforums.com/showthread.php?t=151398 should help.

wow.. what a timing :)