⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Multiple Fields



Abid Rizvi
  • profile picture
  • Member

Posted 03 July 2015 - 05:51 AM

I have the Database Schema (see attached image db_schema.png)

 

I have created the output form as (add-questions.png)

 

I want to save this into DB  field "choices"?

 

 


Paul Savostin
  • profile picture
  • Member

Posted 03 July 2015 - 09:21 AM

Hi! You doing wrong, for field choices you need to use ENUM type, that's it


Abid Rizvi
  • profile picture
  • Member

Posted 06 July 2015 - 04:51 AM

Hi,

Thanks for your response. But I want to save  a custom value with True and False of it. I am making a quiz.

In ENUM we can have only predefined values.

Do you have any suggestion for custom values of choice with its True/false value?


Paul Savostin
  • profile picture
  • Member

Posted 06 July 2015 - 10:00 AM

Hi! Plan your database schema in the rigth way! No one database type would'n be good for your situation.

I think you need put "answers" to another table and make one-to-many relationship between questions and answers (primary_id, answer (text), condition(boolean), question_id)

For example first method will be the list of questions and second - list of answers by question ID.

Then you easily can add more then 4 answers per question, change answers order and so on. And this is wiil be the normal databse designing.

Hope it helps.