Hi Guys,

Can someone help me. I am using FCK Editor when I add a new news article to my website. When entering each new article, I have included an option where there is a drop-down list to select a particular news category.

In the front-end of the website the news page displays all news articles from all categories, even if I select a different category for each news article.

My problem is I am stuck on how to display news articles from only the selected category when adding a new article. A solution would enable me to display a news article from any particular news category on any webpage on my website and display another news article from a different category on a different web page.

I suspect it may be a problem with the SQL statement in the content-news code, but I'm not sure as I am not too good at SQL statements.

See attached files: content-news.txt and addnews.txt

Can anyone help me out?

To display only one particular type of news articles in a drop down menu, you need to ensure you have a category table and the news_category compound table in your database where all of the news articles are linked to a category.

Then you can add the WHERE command to your SQL statement:

SELECT nTitle, date_format(nDate, '%d %M, %Y'), nContent FROM news, news_category WHERE category = 1 order by nDate DESC

When doing the match you can use the index of the selected category after getting it from a drop down menu of categories in your PHP code.

Hope that helps.

Howdy stephNicolaou,

Thanks for your reply. It is greatly appreciated. I'll give it a go and send you the results.
Thanks again.

davBro

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.