mdavenpo Posted November 9, 2015 Share Posted November 9, 2015 Please forgive me if i have posted something that has been answered before, i'm unsure of what this would be called so i didn't know what search term to use but couldn't find any other information. ============================ QUESTION ==========================I have a simple PHP array which is pulled from a SQL JOIN query: [0] id //standard table unique id [1] email //teachers email [2] student_email // student email [3] provider // who the provider of the qualification is. [4] course // what qualification is being undertaken. [5] subject // subject of the course. [6] status // marking is either Done or To Resubmit. what i'm trying to do is use the array to calculate how many 'Done' status for each student_email and display so i think i need to somehow put something into variables but im confused on how to achieve this. I'm trying to display on a teachers dashboard a table that shows students near completion. which would show: Student_email Provider Course Assessments_completed (done status) foo@bar.com school1 Business 29 bar@foo.com school2 Management 31 And in advance im so sorry if i have this post in the wrong place as this is the first time ive posted a forum anywhere. Quote Link to comment https://forums.phpfreaks.com/topic/299410-array-extraction-variables/ Share on other sites More sharing options...
Solution Barand Posted November 9, 2015 Solution Share Posted November 9, 2015 Do it all in the query SELECT ..., COUNT(*) as total FROM ... WHERE status='Done' GROUP BY student_email Quote Link to comment https://forums.phpfreaks.com/topic/299410-array-extraction-variables/#findComment-1526091 Share on other sites More sharing options...
mdavenpo Posted November 10, 2015 Author Share Posted November 10, 2015 Hi Barand, Thank you so much for your help. this solved my question. Quote Link to comment https://forums.phpfreaks.com/topic/299410-array-extraction-variables/#findComment-1526093 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.