Skip to content
Advertisement

SELECT All Posts In A Certain Category

I indeed read this post (Get all posts from a specific category) but it does not seem to apply to my situation.

My situation is that i have two tables as follows:

1/ table categories

JavaScript

in which lang_id values are 1 (equivalent to English) and 2 (equivalent to Vietnamese) which is used for filtering by using $_SESSION[‘lid’].

JavaScript

2/ table posts:

JavaScript

In which the category_id is the foreign key of the first table.

JavaScript

I would like to select the posts in a certain category when we mouse-click on it. So, I run this query:

JavaScript

But the result does not return as desired. For example, When I click on category 1 (Arts and Entertainment), the result returns two subjects (arts posted in category_id 1, business and money posted in category_id 5 ).

Can you help me to re-build the query, please? I really really got stuck here.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement