Jump to content

Recommended Posts

EDIT.  Never mind.  I should be able to figure this out using GROUP_CONCAT and a loop.  Can't seem to delete the post, however.

 

I would like a generic approach to store and display matrices such as the following.

 

matrix.png

 

To store the data, I am thinking of the following schema.  While this is a PHP question, if you feel I haven't modeled it correctly, please advise.

 

 

ERD.png

 

Given the chart ID, how would it be best to retrieve the data and create the table?

Edited by NotionCommotion
Link to comment
https://forums.phpfreaks.com/topic/301780-retriving-and-displaying-matrix-data/
Share on other sites

Data is user inputted and if they want, they will have to re-input data for the next chart, however they will most likely not want to.

 

Actually I am still stumped as the cross table may not have a record for a given series/category and I therefore can't always join series and.categories.

perhaps

                      +-------------+
                      |    chart    |
                      +-------------+
+-------------+              |               +---------------+
|   series    |              |               |    category   |
+-------------+              |               +---------------+
       |                     |                      |
       |                    /|\                     |
       |              +-------------+               |
       +-------------<|    value    |>--------------+
                      +-------------+

Thanks Barand, but this would require a value for each series or category.  Guess I will just do it in two queries: one to get say the series with a left outer join for values, and group_concate the values, and a second query for the categories.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.