Jump to content

Automatically Update Marks...


RON_ron

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/220556-automatically-update-marks/
Share on other sites

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          |

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.