Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8344373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:21:05+00:00 2026-06-09T06:21:05+00:00

I have a problem on output the MySQL result to HTML. I had a

  • 0

I have a problem on output the MySQL result to HTML. I had a MySQL result which returns:

| title        | category_name | from_where |
---------------------------------------------
| Title num 1  | Journal       | iidl_file  |
---------------------------------------------
| Title num 2  | Books         | iidl_file  |
---------------------------------------------
| Title num 3  | Announcement  | iidl_post  |
---------------------------------------------
| Title num 4  | News          | iidl_post  |
---------------------------------------------

How can I preview this data in HTML like this:

iidl_file
 - Title num 1 (Journal)
 - Title num 2 (Books)

--------------------------

iid_post
 - Title num 3 (Announcement)
 - Title num 4 (News)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:21:06+00:00Added an answer on June 9, 2026 at 6:21 am

    This is what I would do:

    SELECT `title`, `category_name`, `etc` FROM `table_name` ORDER BY `from_where`;
    

    If you have many records, you will benefit greatly from making sure there is an index on the from_where column.

    Here is some pseudo-code:

    $groups = array();
    foreach ($rows as $row) {
        $from_where = $row['from_where']
        if (! isset($groups[$from_where])) {
            $groups[$from_where] = array();
        }
        $groups[$from_where][] = $row;
    }
    

    Now your $groups will contain arrays keyed by the from_where column.

    Doing this, you actually don’t have to even issue the ORDER BY in the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script to output a mysql result to excel, which is working
I'm new to PHP, HTML and MySQL, and have encountered the following problem: I
I have a mysql database which as one of the fields contains a html
I have a problem that output string must be utf8-formatted, I am writing currently
So I have this problem where the output prints the address of my pointer,
Problem I have some pages that need dynamic data from website to generate output
I have a strange problem, I am trying to order the output of a
In PHP I have a function, the problem is it will output an extra
I have a problem with a subquery involving IPV4 addresses stored in MySQL (MySQL
I have a big mysql query which needs to trawl through 4 tables to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.