Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2008
    Posts
    106
    Thanks
    27
    Thanked 3 Times in 3 Posts

    pagination and anchors

    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?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,464
    Thanks
    8
    Thanked 1,085 Times in 1,076 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.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    PHP5 Pagination should help.

    Edit: wow.. what a timing
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •