Assigning variables and their values from ARRAYS
View Single Post
06-02-2008, 11:12 PM
Join Date: Apr 2008
Thanks to all who replied...
Just to answer the question about the nature of the query and what I am trying to do, here goes:
I have a table that contains an "answer key" for a given test. There is a row for each test item. The fields in the table include, among others, "munit" (instructional unit for each math item).
The values in the field can vary widely from test-to-test, since not all math instr. units have to be represented on every test.
Thus, I executed a query that gave me, for this particular test, the "munits" that are represented on the test, as well as the number of items within each "munit". The query was:
SELECT munit, count(munit) AS mvar
GROUP BY munit;
If I do a print_r, here are the array results (with no formatting):
Array (  => 1  => 4 ) Array (  => 2  => 19 ) Array (  => 4  => 18 ) Array (  => 5  => 5 ) Array (  => 6  => 7 ) Array (  => 7  => 19 ) Array (  => 9  => 6 )
So, when the test items are scored, I can compute the percent correct for each applicable "munit". Thus, I need a series of variables, such that...
$mUnit1 = 4, $mUnit2 = 19, etc...
Does this make sense? Again, I appreciate the help I've already received.
View Public Profile
Send a private message to Dave
Find More Posts by Dave