I have a form field that accepts multiple values (Number values between 00-999) that I want to store inside a MySQL field.
What is the best option to go with? (Field type?)
I want to store the data in this format,
1|2|3|4|5|
I want to later query those values and be able to separate them from each other with PHP for mathematical operations.
It is not good idea to store values using glues like commas and pipes. Because later when you need to execute sql and to some mathematical operation , it will be tedious. IMO seperate bridge table will do the task
tables
forms
id, name
form_values
form_id value
1 1
1 2
1 3
you can use group_concat
to fetch value as your output and can have calculations easiliy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.