Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: pagination and anchors
12-04-2008, 09:39 AM #1
- Join Date
- Sep 2008
- Thanked 3 Times in 3 Posts
pagination and anchors
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 #2
- Join Date
- Jun 2003
- Cottage Grove, Minnesota
- Thanked 1,096 Times in 1,087 Posts
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 #3
- Join Date
- Mar 2007
- Thanked 2,224 Times in 2,211 Posts
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)