Reputation: 356
I want to store array [3,9,21]
in database (mySQL).Other than saving the values of array, I want to save the whole array in the database. Is it possible?
Upvotes: 1
Views: 1893
Reputation: 1191
If you are using MySQL 5.7+ you can; it introduced a JSON data type https://dev.mysql.com/doc/refman/5.7/en/json.html
A quick read about the changes: http://lornajane.net/posts/2016/mysql-5-7-json-features
PS -- I'm a fan of the comment above -- storing values as separate rows instead of as arrays is a better option
Upvotes: 5