简体   繁体   中英

what should i use php mysql or json file to retrieve data?

I am developing online exam system for MCQ based Exam in php and mysql.

My database structure is as follows :

tests table -> Store data when admin create

questions table -> store questions with 5 option and ans

testtaken table -> store data of user give exam (inserting 1 row when user give new test)

ans table-> store ans given by user

Now at user end i am currently using direct MySQL query from database and display 200 questions using jquery ui tabs.

From Past few weeks i analysed many things for online exam from here and there. I come to conclusion that for questions which will be around 200 or more i will create .JSON file from database once.When users give exam every time it will not go to database and take data from JSON file.

So Is my desicion is good or using direct mysql quires every time ?? I am doing this for future because mysql will load slowly when many users give tests at a time.

Thanks in advance

EDIT : - I cant use php pagination with ajax Because we have timer in exam page so user may lose time at time of loading question using pagination ( May be possible internet problem so high time waste for users ).

Improve yoir db design u will feel better. For example, u can just store pass fail for users, or keep just wrong answers that can be in another table with user_id. Besides, even if you create a file its going to be unsafe. So again, just compare with sending data and retrieve true/false value.

When your data is not changing that often in the database, there would be no drawback of storing a JSON file and sending that to user every time. Definitely it is faster.

But from a design strategy it wouldn't be the best solution. What I suggest is to store the images in the file system and just store the URL in the database and query the database every time a user needs to start a exam. In this way you have more freedom with data you will provide to the user.

For example in the future if your question bank has 1000 questions and you want to select 200 of them randomly, this design would be more flexible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM