URL link to call database to build dynamic html page

Discussion in 'PHP' started by michaelh613, Nov 21, 2007.

  1. #1
    I create a page of links by querying a database and bringing up a list of businesses. Now what I want to do is have someone click on one of the links and then bring up the specific data for that business (also in the database)
    How would I encode the information needed into the link I create so it can be be used to query the database.

    I am assuming I have to link a session variable to each link that will be used as my primary key to query the database the 2nd time.
     
    michaelh613, Nov 21, 2007 IP
  2. serialCoder

    serialCoder Guest

    Best Answers:
    0
    #2
    you can include a primary key in your query and then have a querystring with its value

    ex: link.php?id=primary_key
     
    serialCoder, Nov 21, 2007 IP
  3. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    serialCoder is correct :)

    Create a series of links using the primary keys generated from the database.

    Then within the link.php access the primary key via

    $_GET['id'];

    Have fun :)
     
    tonybogs, Nov 21, 2007 IP
  4. chandubhai

    chandubhai Banned

    Messages:
    556
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Why dont you try using ajax
     
    chandubhai, Nov 22, 2007 IP