Monday, April 10, 2017

Store image names one by one or as array in mysql db?

In my app I let users upload up to 5 images eg

vsdfjdifnd.jpg 
gfsffjdifnb.jpg 
asefjdidgd.jpg 
afdffjdifnd.jpg 
xcdfjdifnd.jpg

Should I store the image names one by one or as an array in my MySQL DB?

Right now I have a table called images that looks like this:

id - (PK) 
i_u_id - (FK) points to primary key in Users table 
image_name - (String) that holds the image name 'something.jpg'

It feels that my DB gets filled fast, so I was wondering I should store the image names as a array instead?



via Kiow

Advertisement