0

I'm planning to do a MCQ exam system. When users are doing exams I'm thinking about to create a table (temparary ) in the beginning of every exam to save user's questions numbers and user's answers. End of the exam I will calculate marks and show users right answer and wrong answer. And after that i will drop the table that created for the exam since i don't want it any more and because of the space of the database. Am i doing it write or is there any other way to do that?

Thank you.

K_N_
  • 21
  • 1
  • Or, instead of creating/dropping tables, you can just write records to an existing table. – David Jan 24 '18 at 10:40

1 Answers1

1

If you want to store temporary data, Use session instead of database table.

//Start session
session_start();
//Then
$_SESSION['temporaryData'] = $data;
Shahnawaz Kadari
  • 1,423
  • 1
  • 12
  • 20
  • Thank you. In case, using computer break down or a power cut middle of the exam, i want user to start resume the exam where it is left. Can i do that with sessions? – K_N_ Jan 25 '18 at 02:14
  • In this case there may be chance to lost user data if session passe it's lifetime(default lifetime is about 24 minutes), You've to use cookies to store user temporary data to browser or increase sessions lifetime. More about session read here https://stackoverflow.com/questions/156712/php-what-is-the-default-lifetime-of-a-session – Shahnawaz Kadari Jan 25 '18 at 08:39