i need to store 60 answers from some questions. which is the best approach: for every user that takes the questions to have a record in a table with 60+ columns or to store them in another table that only stores user, question_id and answer? It must be anonymously also
If your storing a user then it isnt going to be anonymous; though you can display the answers without the user details and thus make it anonymous to the markers even if it isnt anonymous in the database.
may i ask something else. i have 60 questions that i want to show and to do that i have to do at once 4 queries for every questions, which means 240 queries at once. is this very bad? should i do only one that getss all the information i need and then to sort/show it with php?
$qry="select answers.id_ans,answers.sub_no,answers.sub_question,answers.answer,questions.type from answers,questions where answers.id_ans=questions.id_questions and id_ans=$num"; this is the main query to take every answer for a question, im also thinking if it is wise to count numeric answers with sql and to find perstenages. for example for a yes or no type queston to do this: $qry="select count(answers.answer) from answers where answers.id_ans=$num and answer='yes'"; $qry="select count(answers.answer) from answers where answers.id_ans=$num and answer='no'"; $qry="select count(answers.answer) from answers where answers.id_ans=$num and answer='no' or answer='yes'"; Ans if someone wants to see all the answer to create a loop to do this for every question. is there a way to do all of those in one query? should i do it or should i take all the answers from all the questions with one query in some other cases it is not so simple to find the ammount of an answer because i have multiple choice answers so in those i presume i have to find the number of every answer in php