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 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Forum code using MySQL/PHP

    Hi all,

    I am currently working on coding a forum for my website. I am fairly new to this coding stuff so i apologise if if this is something really easy.

    The way i have coded the forum so far is that one page will display a list of all the topics within that forum. It also displays the unique ID of that topic. The topic headings are set up as a link which when clicked i want it to search the database for all the replies that link to that topic. I have linked the replies to the topics using simply the topic ID.

    The problem i am having is i cant work out how to pass the ID variable along in my link, or how to code the link so it will find the replies for that particular topic.

    Maybe i have gone about it all totally wrong and need to start from scratch. Any help would be greatly appreciated,

    Thanks
    Drink up me hearties.....Yo Ho!!!

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This really sounds like a PHP issue rather than a MySQL issue. You'd probably get better answers if a mod moves this to the PHP forum.

    But to send a variable over a link, you just need to add it to the querystring:

    PHP Code:
    echo '<a href=\"/path/to/page.php?var=value\">'
    Then 'var' will be in page.php's $_GET array, and you can pull it from there.

  • #3
    Regular Coder
    Join Date
    Dec 2002
    Location
    a bit west of pittsburgh
    Posts
    236
    Thanks
    1
    Thanked 0 Times in 0 Posts
    correct me if i am wrong, but when you use single quotes, you do not need to escape those characters.

    PHP Code:
    echo '<a href="/path/to/page.php?var=value">'

  • #4
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's true; my slashes were unnecessary. Force of habit.


  •  

    Posting Permissions

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