Hello I am trying to link user comments to particular articles in a website I am developing.
I have two mysql database tables Programme and Comments.
Programme has a primary key of progid which is also a foreign key in Comments.
But I am having trouble with the query retrieving the programme article and the comments attached to that article in the same page.
Im a total noob Im more of a front end developer but would love to get more experience with php.
Any help would be great.
Thanks Nacho.
Comments
Moderator: General Moderators
Re: Comments
Code: Select all
SELECT * FROM Programme WHERE progid=37; // this will select a specific programme
SELECT * FROM Comments WHERE progid=37; // this selects the comments that belong to itRe: Comments
Or one query:
Code: Select all
SELECT * FROM Programme AS a
JOIN Comments AS b ON a.progid=b.progid
WHERE a.progid = 37
-
nachoman316
- Forum Newbie
- Posts: 12
- Joined: Sat Apr 11, 2009 6:40 am
Re: Comments
Thanks for the help guys I'll give those a bash.
Cheers Nacho
Cheers Nacho