jeudi 16 mars 2017

How to add values to the array using 3 select queries in sql and php

There is a question pool.

question{ question_id PRIMARY KEY, question, option1, option2, option3, option4, level_id FOREIGN KEY, category_id FOREIGN KEY }

exam_paper{ exam_paper_id, exam_paper_name, level_1_no_of_questions, level_2_no_of_questions, level_3_no_of_questions } exam_paper_questions{ id PRIMARY KEY, exam_paper_id FOREIGN KEY, q0, q1, q2,q3, q4, q5, q6, q7, q8, q9 }

there are 10 questions in the question paper. there are 3 levels of questions like easy, intermediate and difficult. I want to add 3 questions from easy level(level 1), 4 questions from intermediate level(level 2) and 3 questions from difficult level(level 3) randomly selected from the question pool into the exam paper. How to write the query? and how to insert to the questions to paper?




Aucun commentaire:

Enregistrer un commentaire