Welcome Guest, Not a member yet? Register   Sign In
Help modeling assignments
#4

[eluser]pabloheim[/eluser]
[quote author="jedd" date="1250481604"]Howdi,

You are correct - strings containing multiple integers, separated by commas .. is not a good way of recording this information.

Quote:i have another idea : imagine we have a table called assignments. it has two columns : "task_id" and "member_id". If the boss asks members 1, 4,8 to solve the task "30", then this is stored like this:

You are on the right track here. Typically you would have an id column, AUTO-INC, UNIQUE, etc - as your primary key.

And you'd call the table by the name of the two tables you're connecting - so member_task (usually alphabetical ordering). This is a bit traditional Active Record (as opposed to CI's AR) but consistency is good, and their standard is as good as any. You'd also make the two columns you've mentioned here as INDEX, of course.


Quote:This solution is easy for extract : select member_id where task_id="30"
but a little bit difficult to insert.

What cases do you see inserts to be difficult for?[/quote]

hi, thanks for comment.
i think it could be a little bit difficult because the function that insert the data receives a string like this "1,4,8". Thus, i have to separate before insert. and i need to know how many ids are to pass this parameter to a loop function like for or foreach.
Its not super difficult, but it needs some attention.

i receive a string because in my project, when the boss selects the team to solve the task, he does it throught a drag and drop system made with jquery ui. then when he click "Assign" , a little js script takes an "ul" whose "li" are team members and catch the memebers id and then pass as a value to a hidden input to finally submit the form.

I think im going for the solution you suggest, its more flexible. thanks a lot!


Messages In This Thread
Help modeling assignments - by El Forum - 08-16-2009, 04:44 PM
Help modeling assignments - by El Forum - 08-16-2009, 05:00 PM
Help modeling assignments - by El Forum - 08-16-2009, 05:04 PM
Help modeling assignments - by El Forum - 08-17-2009, 07:55 PM
Help modeling assignments - by El Forum - 08-17-2009, 08:02 PM
Help modeling assignments - by El Forum - 08-17-2009, 08:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB