0

I'm not sure how to word this in my title so I'll try and explain the best I can here.

I want to create a news page for my website, having around 8 articles per page, which would be one update via SQL. But I wondered if there was a way to select a particular article based on it's theme using PHP later on. What I would have are 2 tables:

Articles:    ID | Article 1 | Article 2 | Article 3 | etc
Themes:      ID | Theme 1 | Theme 2 | Theme 3 | etc

So a basic post would look like:

Articles:     1 | Text for article 1 | Text for article 2 | Text for article 3 | etc
Articles:     2 | Text for article 1 | Text for article 2 | Text for article 3 | etc
Themes:       1 | Local | Sport | Business | etc
Themes:       2 | Business | Sport | Local | etc

So here, In Post 1, Article 1 is a post about the local area and Article 2 is about Sport, whereas in Post 2, Article 1 is about the Business and Article 2 is about Sport.

What I would like to do is have a PHP script which can select any article from any column based on it's theme.

So for instance:

SELECT ( CELL ) FROM articles WHERE ( THE CORESPONDING COLUMN IN THEMES ) = 'Business'

I'd also like to be able to select multiple rows. (SELECT * FROM articles LIMIT 12).

Can anyone advise or help with this? Thanks.

Steve Gee
  • 49
  • 1
  • 8
  • Possible duplicate of [Difference between JOIN and INNER JOIN](http://stackoverflow.com/questions/565620/difference-between-join-and-inner-join) – Saa Feb 02 '17 at 15:26
  • Which Join would I use to achieve what I'm trying to do? – Steve Gee Feb 02 '17 at 18:12

0 Answers0