#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    75
    Rep Power
    2

    How do I efficiently display all topics?


    In my website I want to display all the news category-wise in a table.
    Admin can add categories and registered users can add news in any category.

    Solution I have now is this: -
    I loop through all the categories and then for each category I loop through all the news and display only that which belong to the category. I am using two loops here. Any ideas to do it better?

    Basically I must display category heading in the top and news that belong to it below.
    How do I do this more efficiently?

    P.S. Sorry if this is the wrong sub-forum to post this thread.
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,124
    Rep Power
    4304
    Yes, the web design help forum is mostly for non-programming questions.

    Which server-side language and database system are you using?
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo