View Full Version : Help with Forum code using MySQL/PHP

07-13-2005, 03:07 PM
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,


Kid Charming
07-13-2005, 06:30 PM
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:

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.

07-13-2005, 08:10 PM
correct me if i am wrong, but when you use single quotes, you do not need to escape those characters.

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

Kid Charming
07-13-2005, 08:14 PM
That's true; my slashes were unnecessary. Force of habit. :)