For example I have file names A, B, C, D then I want to insert them in database in a single field then it will look like this in a table
ID | filename | PATH | DATE |
1 | A, B, C, D| DOCX | Mar. 10, 2017|
For example I have file names A, B, C, D then I want to insert them in database in a single field then it will look like this in a table
ID | filename | PATH | DATE |
1 | A, B, C, D| DOCX | Mar. 10, 2017|
Never put comma separated data like A, B, C, D
in a single column. Instead use Normalization
.
Normalization is a database design technique which organizes tables in a manner that reduces redundancy and dependency of data. It divides larger tables to smaller tables and link them using relationships.
In your case make an another table like tbl_filenames
and put multiple entries of file name in it and bind it with your base table with \
id -> file_id basic
means on each entry in base table their are multiple file entry in tbl_filenames
and bond together user id->file_id
Just concatenate those & insert like a single value. Its up to you if you wanna do that, But its against normalization & will make system harder to handle, but after all if you insist on doing that:
INSERT INTO tblName (`ID`, `filename`, `PATH`, `DATE`) VALUES (1, "A" . ", " . "B" . ", " . "C" . ", " . "D", "DOCX", "Mar. 10, 2017")