...

View Full Version : pagination and anchors



ktsixit
12-04-2008, 08:39 AM
Hello,
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?

mlseim
12-04-2008, 01: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.

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

wow.. what a timing :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum