That wont work either.
Lets see if this can shed some more light for you.....
If Staff Member A has access to department 1 2 and 3 then the allocation table will look like:
1 1
1 2
1 3
So 1 2 and 3 will be pre-selected in the profile form. Now if admin decides to add them to department 4 then the array passed to the script when admin hits update will be the 3 preselected values 1 2 and 3 but also 4. If I use IN and pass in the array I'll get duplicate key errors for 1 2 and 3 as all that needs to be inserted is 4
Same with de-selects. If 1 2 and 3 are selected and admin deselects 3 and hits update then I only need to delete 3 not 1 and 2.
I need some way to match two arrays and push any non-matches into a third array...
eg....All depts staff member A belongs to:
@array1 = qw( 1 2 3 );
...all selection from the form....
@array2 = qw( 1 2 3 4);
....now if I can get rid of duplicates and push 4 into a new array then I can to the insert/delete without a problem.
Lets see if this can shed some more light for you.....
If Staff Member A has access to department 1 2 and 3 then the allocation table will look like:
Code:
UserID DeptID 1 1
1 2
1 3
So 1 2 and 3 will be pre-selected in the profile form. Now if admin decides to add them to department 4 then the array passed to the script when admin hits update will be the 3 preselected values 1 2 and 3 but also 4. If I use IN and pass in the array I'll get duplicate key errors for 1 2 and 3 as all that needs to be inserted is 4
Same with de-selects. If 1 2 and 3 are selected and admin deselects 3 and hits update then I only need to delete 3 not 1 and 2.
I need some way to match two arrays and push any non-matches into a third array...
eg....All depts staff member A belongs to:
@array1 = qw( 1 2 3 );
...all selection from the form....
@array2 = qw( 1 2 3 4);
....now if I can get rid of duplicates and push 4 into a new array then I can to the insert/delete without a problem.