I have a db that holds question and answer information...there are multiple arrays comming from it. What I can't figure out how to do is find out how many times a particular question has been answered correctly and do the calculation of the % correct.
Here is what the arrays look like from the MySQL DB.
$i=1;
do {
$ID[$i] = $row_Recordset1['ID'];
$DateTaken[$i] = $row_Recordset1['DateTaken'];
$TestTypes[$i] = $row_Recordset1['TestType'];
$TestNames[$i] = $row_Recordset1['TestName'];
$TestNumber[$i] = $row_Recordset1['TestNumber'];
$Question[$i] = $row_Recordset1['Question'];
$YourChoice[$i] = $row_Recordset1['YourChoice'];
$RightAnswer[$i] = $row_Recordset1['RightAnswer'];
$TimeSpent[$i] = $row_Recordset1['TimeSpent'];
$PacerTime[$i] = $row_Recordset1['PacerTime'];
$i++;
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
What needs to be done:
Say Question 38 has been answered 10 times and 5 times it was answered correctly = 50% correct
Now Question 38 can be anywhere in the array $Question[??] and appear any mount of times.
A sample dump of the array from the DB:
ID DateTaken TestType TestName TestNumber Question YourChoice RightAns TimeSpent PacerTime
38 2005-01-25 MATH GMAT 1 38 2 2 113.944 0.73512258
39 2005-01-25 MATH GMAT 1 76 5 2 63.521 0.42347333
40 2005-01-25 MATH GMAT 1 77 1 2 126.302 0.84201333
41 2005-01-25 MATH GMAT 1 41 3 4 66.085 0.44056666
42 2005-01-25 MATH GMAT 1 42 3 2 85.473 0.58946896
43 2005-01-25 MATH GMAT 1 43 1 1 50.933 0.35126206
44 2005-01-25 MATH GMAT 1 44 2 3 385.054 2.65554482
45 2005-01-25 MATH GMAT 1 45 1 4 59.635 0.41127586
46 2005-01-25 MATH GMAT 1 46 4 4 50.663 0.3494
48 2005-01-25 MATH GMAT 1 48 1 1 85.052 0.60751428
49 2005-01-25 MATH GMAT 1 49 5 2 57.823 0.41302142
50 2005-01-25 MATH GMAT 1 50 3 2 75.929 0.54235
51 2005-01-25 MATH GMAT 1 51 2 4 124.309 0.88792142
52 2005-01-25 MATH GMAT 1 52 3 1 121.625 0.90092592
53 2005-01-25 MATH GMAT 1 53 3 3 69.15 0.51222222
54 2005-01-25 MATH GMAT 1 54 2 2 64.052 0.47445925
55 2005-01-25 MATH GMAT 1 55 5 4 54.598 0.40442962
56 2005-01-25 MATH GMAT 1 56 3 3 188.531 1.39652592
57 2005-01-25 MATH GMAT 1 57 2 3 84.822 0.62831111
58 2005-01-25 MATH GMAT 1 58 1 2 514.41 3.957
61 2005-01-25 MATH GMAT 1 61 4 2 48.139 0.43762727
62 2005-01-25 MATH GMAT 1 62 1 2 27.31 0.2731
64 2005-01-25 MATH GMAT 1 27 5 4 67.888 0.71461052
65 2005-01-25 MATH GMAT 1 28 3 3 56.15 0.59105263
66 2005-01-25 MATH GMAT 1 29 4 4 60.527 0.67252222
67 2005-01-25 MATH GMAT 1 67 3 3 71.533 0.84156470
68 2005-01-25 MATH GMAT 1 68 3 2 55.81 0.65658823
69 2005-01-25 MATH GMAT 1 69 4 3 17.195 0.20229411
71 2005-01-25 MATH GMAT 1 34 1 3 114.204 1.42755
72 2005-01-25 MATH GMAT 1 35 3 4 32.727 0.4090875
73 2005-01-25 MATH GMAT 1 36 2 5 26.548 0.33185
75 2005-01-27 MATH GMAT 1 38 2 2 42.203 0.28135333
76 2005-01-27 MATH GMAT 1 76 5 2 128.672 0.85781333
77 2005-01-27 MATH GMAT 1 77 2 2 34.297 0.22864666
78 2005-01-27 MATH GMAT 1 78 3 3 99.203 0.66135333
79 2005-01-27 MATH GMAT 1 79 2 2 50.703 0.33802
80 2005-01-27 MATH GMAT 1 80 5 5 189.359 1.35256428
81 2005-01-27 MATH GMAT 1 81 3 3 77.578 0.53502068
82 2005-01-27 MATH GMAT 1 82 2 2 107.672 0.74256551
84 2005-01-27 MATH GMAT 1 121 1 1 222.328 1.53329655
85 2005-01-27 MATH GMAT 1 122 5 5 50.938 0.35129655
86 2005-01-27 MATH GMAT 1 123 2 2 230.187 1.64419285
87 2005-01-27 MATH GMAT 1 124 5 5 59 0.42142857
88 2005-01-27 MATH GMAT 1 125 1 1 146.172 1.04408571
89 2005-01-27 MATH GMAT 1 126 3 3 136.906 1.01411851
90 2005-01-27 MATH GMAT 1 127 5 5 529.672 3.92349629
92 2005-01-27 MATH GMAT 1 129 3 3 201.25 1.49074074
93 2005-01-27 MATH GMAT 1 130 3 3 137.016 1.01493333
94 2005-01-27 MATH GMAT 1 131 2 2 77.281 0.57245185
95 2005-01-27 MATH GMAT 1 132 3 2 59.219 0.45553076
96 2005-01-27 MATH GMAT 1 133 5 1 31.078 0.248624
97 2005-01-27 MATH GMAT 1 134 3 3 67.891 0.59035652
98 2005-01-27 MATH GMAT 1 135 2 2 26.593 0.24175454
99 2005-01-27 MATH GMAT 1 136 5 5 38.875 0.38875
100 2005-01-27 MATH GMAT 1 137 3 3 24.594 0.24594
101 2005-01-27 MATH GMAT 1 138 5 5 73.172 0.77023157
102 2005-01-27 MATH GMAT 1 139 4 4 150.187 1.58091578
103 2005-01-27 MATH GMAT 1 140 1 1 90.797 1.00885555
104 2005-01-27 MATH GMAT 1 141 2 2 52.672 0.61967058
105 2005-01-27 MATH GMAT 1 142 2 4 200.766 2.36195294
106 2005-01-27 MATH GMAT 1 143 5 5 152.89 1.79870588
107 2005-01-27 MATH GMAT 1 144 3 3 29.5 0.36875
108 2005-01-27 MATH GMAT 1 145 2 2 146.141 1.8267625
109 2005-01-27 MATH GMAT 1 146 1 1 89.5 1.11875
110 2005-01-27 MATH GMAT 1 147 2 2 104.938 1.311725
112 2005-01-27 MATH GMAT 1 38 3 2 163.105 1.05229032
113 2005-01-27 MATH GMAT 1 39 1 1 46.186 0.30790666
114 2005-01-27 MATH GMAT 1 40 2 2 115.086 0.76724
If I can figure out the % Correct problem, it will be easy to do the average time spent on each question and average pacer time spent on each question.
Any help would be greatful