argrafic Posted May 2, 2008 Share Posted May 2, 2008 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: 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!!! Quote Link to comment Share on other sites More sharing options...
Barand Posted May 2, 2008 Share Posted May 2, 2008 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 Quote Link to comment Share on other sites More sharing options...
argrafic Posted May 5, 2008 Author Share Posted May 5, 2008 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! Quote Link to comment Share on other sites More sharing options...
Barand Posted May 5, 2008 Share Posted May 5, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.