this question has answer here:
how insert values database comma.
in quiz app 4 multiple choices. user can take quiz can click next button each time post values this:
$category_id = $_post['category_id']; $answerid = $_post['answerid']; $questionid = $_post['questionid']; $timetaken = $_post['timetaken'];
each time user can take 10 questions quiz. how save these values following:
user_id category_id answer_id questionid timetaken 1 2 3,4,4,3 1,2,3,4 2,3,4,5<br>
category_id same 10 questions. how save answer_id, questionid , timetaken values separated comma?
first use dtat type column varchar or text
and in code have array values answer_id, question_id , timetaken.
i mean must set attr name input tag name="answer_id[]"
.
it lot
and in php code before insert query use impode function comma delimator
something below:
$ansres = implode(",",$_post['answer_id']);
and use variable in insert query.
it insert value required.
i hope you.
Comments
Post a Comment