I'm creating a way that a "teacher" could make an exam and the "student" can take an exam.
First off, it is also possible for a teacher to make new questions, using this query:
INSERT INTO questions (question, type) VALUES ('$question', '$type')
SELECT * FROM questions
INSERT INTO exams (question_id) VALUES ('$question_id')
SELECT question FROM questions WHERE question_id='1,2,4,10'
Assuming you are getting the question id by POST or GET, Try this:
$selected = implode(',', $_REQUEST['selectedquestionids']); SELECT question FROM questions WHERE question_id IN ($selected) GROUP BY question_id;
Hope this may help.