Jump to content

Help with creating table in database and how to program it


argrafic

Recommended Posts

Well, I'm about to start a new project and I face with something I had never faced before.

 

It's a form to input some data that will be registered about projects.

 

The issue here is in the image i post:

tabla.jpg

 

I'm really lost, I don't know how to do it so it stores all the data.

 

I was thinking of making a table for each column and all will be identified with the main id of the project, but i don't know if that's the best way to do it.

 

Thanks!!!

Link to comment
Share on other sites

You only need another table where there can be multiple values, such as alarma and notas

 

[pre]

Phase                                            Task

==========                                        ===============

PhaseID    ------------------------------------<  PhaseID

Phase                                    +-----  TaskID    -------+

Duracion Est                              |      Task              |

Inicio                                    |                        |

Final                                    |                        |

Duracion Real                            |                        |

                                          |                        |

                      Alarma            |                        |          Notas

                      =============      |                        |          ==========

                      alarmaID          |                        |          notasID

                      TaskID  >---------+                        +-------<  TaskID

                      alarma                                                  notas

Link to comment
Share on other sites

nice, thanks!!!

 

but, now, how should the interphse be constructed? it's suppossed to be shown like the image, all the fields at the same time.

 

and how would the mysql query be like? with a for or a while?

 

thanks!

Link to comment
Share on other sites

I noticed I forgot the task responsible column.

[pre]

Phase                                            Task

==========                                        ===============

PhaseID    ------------------------------------<  PhaseID

Phase                                    +-----  TaskID    -------+

Duracion Est                              |      Task              |

Inicio                                    |      Resp              |

Final                                    |                        |

Duracion_Real                            |                        |

                                          |                        |

                      Alarma            |                        |          Notas

                      =============      |                        |          ==========

                      alarmaID          |                        |          notasID

                      TaskID  >---------+                        +-------<  TaskID

                      alarma                                                  notas

[/pre]

SELECT p.Phase, p.Duracion Est, p.Inicio, p.Final, p.Duracion_Real,
t.Task, t.resp, GROUP_CONCAT(a.alarma) as alarms, 
GROUP_CONCAT(n.notes SEPARATOR '<br>') as notes
FROM Task AS t
    INNER JOIN phase AS p  ON t.PhaseID = p.PhaseID
    INNER JOIN alarma AS a ON t.TaskID = a.TaskID
    INNER JOIN notas AS n ON t.TaskID = n.TaskID
GROUP BY t.TaskID
ORDER BY t.PhasID, t.TaskID

 

Loop through result with a while loop. Output Phase when a new phase starts.

Link to comment
Share on other sites

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.