RON_ron Posted December 3, 2010 Share Posted December 3, 2010 I'm creating a system to calculate the marks of a students examination. db1 The students is asked to select the correct answer out of 3 given answers (A, B or C). All those answers will be stored in a MYSQL db (below is the db design example). | Question 1 | Question 2 | Question 3 | Question 4 | Question 5 | Your Marks | Mickey | A | C | C | A | B | 0 | Nathan | C | B | C | B | A | 0 | Jeff | A | C | C | A | B | 0 | db2 The correct answers will be stored in a separate db. The correct answers will be updated after the exam is over. (below is the db design example). | Question 1 | Question 2 | Question 3 | Question 4 | Question 5 | Section A | A | C | C | A | B | Section B | C | B | C | B | A | Section C | A | C | C | A | B | Now here come my question.... How do I automatically update the Your Marks column when I post the correct answers to db2. Basically I need a way to match db2 results against db1 for each row and update Your Marks with the COUNT of the matching answers for each student. Example: Here's how db1 should be when the answers are updated in db2. | Question 1 | Question 2 | Question 3 | Question 4 | Question 5 | Your Marks | Mickey | A | C | C | A | B | 5 | Nathan | C | B | C | B | B | 4 | Jeff | B | B | B | B | B | 1 | Hope my question is clear. I really appreciate your help. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/ Share on other sites More sharing options...
RON_ron Posted December 3, 2010 Author Share Posted December 3, 2010 oops! the db2 design is like this ( the db with the correct answers)... sorry! | Question 1 | Question 2 | Question 3 | Question 4 | Question 5 | Section A | A | C | C | A | B | Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1142579 Share on other sites More sharing options...
fenway Posted December 5, 2010 Share Posted December 5, 2010 Why update the marks on-the-fly? Just calculate them at run-time. Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1143277 Share on other sites More sharing options...
RON_ron Posted December 6, 2010 Author Share Posted December 6, 2010 In the application there is a section where it shows the top 10 scorers. That's why I needed it calculated on the fly. Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1143455 Share on other sites More sharing options...
Miss-Ruth Posted December 7, 2010 Share Posted December 7, 2010 Good post... I'm having a similar project. Any input please. Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1143838 Share on other sites More sharing options...
fenway Posted December 8, 2010 Share Posted December 8, 2010 In the application there is a section where it shows the top 10 scorers. That's why I needed it calculated on the fly. I agree with you -- but you're trying to UPDATE it in advance. Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1144482 Share on other sites More sharing options...
RON_ron Posted December 9, 2010 Author Share Posted December 9, 2010 ...but you're trying to UPDATE it in advance. At the beginning I'll have previous semesters points in there for the script to output the ranking. (The ranking is an ongoing thing here). So that won't be an issue. Quote Link to comment https://forums.phpfreaks.com/topic/220556-automatically-update-marks/#findComment-1144879 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.