dc_jt Posted June 20, 2007 Share Posted June 20, 2007 Hi I need to find all staff members who have not downloaded ALL documents for a particular phase. I.e Each staff member is linked to a course and each course has many phases. E.g Course 1 contains Phase A which has documents 1,2,3,4, Phase B has documents 5,6,7,8 I need to find all staff members from this course who havent downloaded all documents for a particular phase. I.e All staff from course 1 who havent downloaded documents 1,2,3 AND 4. I have a document_download table which stores when a staff member downloads a document like: document_download table id staff_id document_id date_downloaded staff table staff_id name address etc Course table course_id name etc Phase table phaase_id course_id etc Document table document_id name Im not sure whats the best way either in a query or using while loops or something but I really need help on this. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/ Share on other sites More sharing options...
dc_jt Posted June 20, 2007 Author Share Posted June 20, 2007 Right so far ive got an array of all staff members for the course. All documents for the phase in an array. And all documents for that phase that have been downloaded in an array. Not sure what to do next though. Check the downloaded array against the 'All documents' array somehow? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/#findComment-278326 Share on other sites More sharing options...
GingerRobot Posted June 20, 2007 Share Posted June 20, 2007 If you are looking to compare two arrays, you can use the array_diff() function. Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/#findComment-278328 Share on other sites More sharing options...
dc_jt Posted June 20, 2007 Author Share Posted June 20, 2007 Thanks for the help, I think this is what Im looking for. One question though, when I am getting all documents which have been downloaded how do I prevent the array showing more than one of the same document id? For example, if someone downloads the document 10 times it will show in the array 10 times, I just want it to be included in the array once? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/#findComment-278363 Share on other sites More sharing options...
dc_jt Posted June 20, 2007 Author Share Posted June 20, 2007 Sorry think Ive found it, does the array_unique function do this? Thanks Edit: No this doesnt work Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/#findComment-278369 Share on other sites More sharing options...
GingerRobot Posted June 20, 2007 Share Posted June 20, 2007 The array_unique function should be what you're looking for - perhaps you could show us a bit of code? Quote Link to comment https://forums.phpfreaks.com/topic/56339-complicated-method-help/#findComment-278504 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.