php - Most elegant solution for humungous problem -


I am working on a site where a user can select those dates, such as date 1, date 2, date 3, etc.

Every date will have some questions, so if the customer has checked 'date 1' to indicate this date, then he will then see a group of text boxes asking about 1 date And how it applies to them

The date is 1 and 2 and there are many questions, but the remaining dates are just 1 question.

These dates and their responses will be used later to personalize the reminder and send it out to the customer.

I should also like, which makes simple (or as simple as possible) to add additional dates and fields.

My question is, what is the best way to store all the dates and their answers related to the user in the database? I was thinking that in the user table, I have boolean column 1 date - the last date (obviously they are not actually designated date 1, date 2 etc.). If the column for date 1 is set to 0, it means that the customer did not check it, and if 1 means that he did and he answered the questions for it.

In the dates of actual storage, I am considering these two options:

1) 1 table for each date, each question I was asked for that date along with the column and I have a column like Q1_name , Q2_name user_id column Date_1 / Code> and answers to that question given by the user.

But I want to be somewhat more elegant because 1), it will create a pain to get all the user's answers, which will calculate what information will be sent to send them personal emails 2) There are only 1 question in some dates, so it will be ugly to create a fully developed table for them.

2) A user_answer with table, column:

  user_id, date_name, question_name, answer_val  

2 seems to be the most elegant yet, but any ideas should be a better solution?

It looks like you want something like the following (basic) table structure:

Users - User ID, User Information
  • Date - DateIt, DateInfo
  • Questions - question id, question info
  • username - userId, dateId - It stores all those dates that apply to a given user and sub Many relationships between people and between the dates show a lot of relationships - a user can have many dates and many users can be
  • date questions - datedays, Question IID - It stores all those queries that apply for a given date and show many relationships between several dates and questions - there can be many questions in one date and, I agree I,
  • U SerResponse - User ID, question, question, reply delivery - It stores all user responses to any questions asked if you need to know how long the question is It is applicable, assuming that they can answer multiple questions for multiple dates, add a dateId column.

  • Comments