I am trying to retrieve numbers from a mysql column, not all of the numbers just certain ones based on company name and test_taken_id. I can do this no problem if I want to hardscript it, but I don't want that. I want the user to enter the company name and the php to figure the rest out and I can't figure out how to do it dynamically. Let me give you an example. I have many users that have taken 3 tests, test #1, #2 and #3. I want to find out how many problems correct user #4 got on test #2, how can I get that? I can add up totals for all three tests for user #4 but I can't distinguish which is for what. This is the code I use that filters the "Test_taken_ID"s, so that I know which tests have been taken by a specific company. (I use my own functions to get the answers).
With another query I can get the names of the users who took those particular tests for that company:
$company_correct = mysql_query($result, $connection);
$name_uniques = filtering_array_columns($company_correct, 'username_id');
echo "Names of test takers: ";
But I need to separate the different tests and add up the numbers for each one. I don't know if this is making sense. Look at these columns.
Test NumberCorrect NumberWrong Company User
1 8 1 A A1
1 6 3 A A2
1 5 4 B A3
2 6 3 C A1
2 8 2 A A1
2 6 4 A A2
3 8 7 B A1
3 6 8 C A2
For company "A" I want to figure out how many problems they got correct on test #1. I also want to figure out how many wrong, but if I can get the "correct" number I can get the "wrong number". Is it possible? Or should I say: how do I do it? Thanks.