0

Show comments of specific news article using php.

I need help guys. I want to show the comments of a specific news article. I have a table for comments and one for news. I added a news_id column in the comments table, which corresponds to the id of the article in the news table. How do I go about this? (procedure of doing it in codeigniter would be best but any other is wrlcomed).

3rd May 2017, 6:53 PM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
10 ответов
+ 2
i dont know if i understand your question, but i thing your sql code should be something like this: select n.article from comments as c, news as n where c.news_id = n.id
3rd May 2017, 9:54 PM
Oliver
+ 1
please give me more information. or show me the code you wrote with the result and an example of your tables
4th May 2017, 6:24 AM
Oliver
+ 1
no i dont
4th May 2017, 12:02 PM
Oliver
+ 1
if i could help you it would be nice if you post your way to solve the problem, or upvote the post which helps to find out your solution
4th May 2017, 4:08 PM
Oliver
0
@Oliver, you've understood it well. I tried using that but I still got the same comments for different news articles. What might be wrong?
4th May 2017, 2:52 AM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
0
Sorry for delay. do u use codeigniter? ?
4th May 2017, 11:47 AM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
0
mmm, its a bit tough then coz its wat I use. let me try to cut out the clutter.
4th May 2017, 12:03 PM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
0
hey @Oliver I've solved it. Thanks for ē help anyway
4th May 2017, 2:42 PM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
0
@Oliver, it was sth to do with how I was handling the data in codeigniter. I had to set the news id, and pass it into the model and the view. But thanx for ur answer really, it reminded me of sm things.
6th May 2017, 7:58 PM
Harold Peter Ssebetta
Harold Peter Ssebetta - avatar
0
Muito Bom
1st Dec 2017, 5:17 PM
DevWeb