please i need your help with my script. I have a website whereby some content headers are put into an archive box, so that when the headers are clicked the content displays. My issue is about the comment that are made on each page.
Normally i pass the page ID with a GET, so if the GET is not set, that means, the article on display is the current article, and the id for it is passed into the WHERE query manually.
The problem is that the comments left by users on old archives article are not displayed on their respective article pages, but on the article of which i passed the ID manually. How can i fix this problem
Here is a bit of the code i'm trying to make work.
Thanks for your time and patience.
$page_name = 'about';
$id = "";
if (isset($_GET['id'])) {
$id = $_GET['id'];
//display content based on the header clicked
} else {
//display content of the current article based on the id. I pass the numeric id of the current article into the where clause that selects the content
//it displays
}
$query6 = mysql_query(" SELECT c.body FROM comment AS c
INNER JOIN about AS a ON
c.article_id = a.about_id
WHERE c.article_id = 3
AND page_name = '".$page_name."'")
Comment Table
CREATE TABLE IF NOT EXISTS`comment`(
`comment_id` int(255),
`article_id` int(255),
`username` varchar(255) ,
`page_name` varchar(255) ,
`comment_body` varchar(300),
`comment_date` datetime,
PRIMARY KEY (`comment_id`)
About Table
CREATE TABLE IF NOT EXISTS `about` (
`about_id` int(255),
`about_head` varchar(255)
`about_content` varchar(4000),
`about_tags` varchar(255) ,
`about_created` datetime,
the URL for old articles
http://localhost/root/about.php?id=3
while the URL for the current article is
http://localhost/root/about.php
so as it is now the current article doenst pass any dynamic id. if i do '".$id."' in the query, and i click the current article nothing is displayed.