jasom Posted June 4, 2015 Share Posted June 4, 2015 (edited) Hi guys, I'm new in PHP. I cannot find tutorial about how to get all categories article is listed in together with article title, author printed on the article list. I have 4 tables in DB: articles = DB for articles detailse: id, title, user_id, post_date articles_categories = id, category_id categories = category_id, category_name users = user_id, user_name, user_mail I want to do this: Which script logic do you suggest? Any kind of help is welcomed. Edited June 4, 2015 by jasom Link to comment Share on other sites More sharing options...
justsomeguy Posted June 4, 2015 Share Posted June 4, 2015 You need to use a join, but the result will contain 1 record per category. You'll need to loop through them to build the list of categories. Link to comment Share on other sites More sharing options...
jasom Posted June 6, 2015 Author Share Posted June 6, 2015 Thank you for your hint. Link to comment Share on other sites More sharing options...
dauruk0512 Posted June 10, 2015 Share Posted June 10, 2015 wait minute how can you join that's table even each table there is no same field to join it, do i wrong this issue? Link to comment Share on other sites More sharing options...
jasom Posted June 10, 2015 Author Share Posted June 10, 2015 wait minute how can you join that's table even each table there is no same field to join it, do i wrong this issue? You can do INNER JOIN but it will results with duplicated rows. Sollution will consist from some kind of PHP hack. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now