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

  • Home
  • SEARCH
  • 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 7440671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:53:13+00:00 2026-05-29T10:53:13+00:00

We have an PHP/MySQL application where the users can create their own databases, which

  • 0

We have an PHP/MySQL application where the users can create their own “databases”, which can become quite complex. On MySQL, it’s structured as a set of property tables, with columns like record_id, field_id and field_value. I’m well aware of the pros and cons of such structure, so please consider this is not changing.

We already have a custom advanced search system where users can query those databases by combining criteria from any field, using boolean operators between and within fields.

Now we have to implement a reporting feature where they’ll be able to craft their own reports. This might include multiple sets of data on a one to many relationship.

For example, consider a “People” database where each person may have multiple contacts and multiple addresses. With our custom search, it’s easy to list all people born in the US, for example. But I also want to display all contacts and addresses for each person on the resultset.

I can see two possible solutions:

  1. A single SQL query with multiple JOIN statements to fetch all data. In this case I may have multiple rows for each person, depending on how many contacts and addresses they have, and I’d have to deal with that on the PHP loop that displays (or organizes) the results. I’m afraid this can get too complex, considering a report may have an unlimited number of one to many blocks of information (on my example, I have only two, addresses and contacts).

  2. For each person, run ‘n’ additional queries, one for each block of one to many data. On my example, that would be one query for the contacts, and another one for the addresses. That approach can lead to a huge number of queries to be run to build the whole report.

I know both approaches have their downsides, but is there a “recommended” way to go on situations like that?

  • 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-05-29T10:53:14+00:00Added an answer on May 29, 2026 at 10:53 am

    This certainly depends on the amount of queries you think you will have to make to retrieve all the data. From a performance standpoint it is recommended to perform the large join as it can be processed far more efficient than multiple small queries.

    You will find that large reports will take longer using your second approach than using your first approach.

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

Sidebar

Related Questions

I have a PHP web application which uses a MySQL database for object tagging,
I have a PHP MySQL application which has a modular design. There are about
I have a PHP/5.2 driven application that uses transactions under MySQL/5.1 so it can
I have PHP application that contain three small applications. Each application have own users
I am in the process of building a PHP/MySql database application which could have
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've
I'm writng a small application in PHP + MySQL and have come to the
I have been working on on an AJAX chat application using php, mysql. It's
I have been writing web applications for quite sometime in PHP with MySQL. I

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.