mysql_fetch_array + creator anchor links in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elwilson
    New Member
    • Jan 2007
    • 2

    mysql_fetch_array + creator anchor links in php

    Hi,

    I'm new to php and looking for suggestions for the following situation:

    1. I created a list of FAQ's that I want to be able to link to to further down the page (where the complete FAQ is listed)

    2. I created the list using the mysql_fetch_arr ary function

    3. Now I'm trying to link the FAQ list at the top of my page to the complete FAQ answer at the bottom of the page through the variable $id "

    I tried this:

    <a name="id" href="faq.php#i d">$id</a> (on list)

    and then,

    <a target="id">$id </a>

    I'm thinking it is more complicated than this because the "id" refers to all
    listings in my faq, not just one. I need it to work so that when $id == 2, the anchor goes only to the faq with id = 2 and when $id == 35, the anchor goes only to the faq with id = 35, etc.

    Any suggestions are appreciated. I would love to learn how to do this in the future!

    Thanks,

    Erin
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Your question has nothing to do with the thread title, i.e. neither MySQL nor PHP is involved here. It is pure HTML, so it really belongs in the HTML forum. But I will answer it here.

    I found this (reworked) snippet at the w3schools.com site. At the place where you want to link from, you sepcify the following link :
    [html]
    <a href="#C4">See Chapter 4.</a>
    [/html]
    At the beginning of the section where you want to jump to, you define the following
    [html]
    <h2><a name="C4">Chapt er 4</a></h2>
    This chapter explains ba bla bla
    [/html]
    Ronald :cool:

    Comment

    • elwilson
      New Member
      • Jan 2007
      • 2

      #3
      Hi Ronald,

      It works! Thanks. I didn't think it would be that easy because I was using a variable that pulls data from by db. Simple is good.

      Erin

      Originally posted by ronverdonk
      Your question has nothing to do with the thread title, i.e. neither MySQL nor PHP is involved here. It is pure HTML, so it really belongs in the HTML forum. But I will answer it here.

      I found this (reworked) snippet at the w3schools.com site. At the place where you want to link from, you sepcify the following link :
      [html]
      <a href="#C4">See Chapter 4.</a>
      [/html]
      At the beginning of the section where you want to jump to, you define the following
      [html]
      <h2><a name="C4">Chapt er 4</a></h2>
      This chapter explains ba bla bla
      [/html]
      Ronald :cool:

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        I agree with that. Sometimes the simplest things are the hardest to find.

        Ronald :cool:

        Comment

        Working...