How PHP handles multiple values processed from a form at once, with a "| |" Do the separators? For example, hobbies add basketball, soccer, and so on as a field stored in the database, between football and basketball with | | As a delimiter?
Reply content:
How PHP handles multiple values processed from a form at once, with a "| |" Do the separators? For example, hobbies add basketball, soccer, and so on as a field stored in the database, between football and basketball with | | As a delimiter?
Not quite understand your problem, if you want to store multiple data in the field, it is 爱好
recommended that all the 爱好
storage array form, in MySQL when the use of serialize()
serialization, read the use of deserialization unserialize()
on it.
Serialization is the process of converting an array or an object into a string so that it can be stored in a database.
//Example$hobby = array('篮球', '足球', '羽毛球', '计算机');echo serialize($hobby);//a:4:{i:0;s:6:"篮球";i:1;s:6:"足球";i:2;s:9:"羽毛球";i:3;s:9:"计算机";}
For information on how to use the serialize()
series functions, refer to the manual:
Serilize ()
Unserilize ()
I can probably understand what you mean, I did not understand the database at first I think so, how to store multiple values in the same field, you just need to create a new data table, such as Db_hobby, the field is "hobby user_id" can