php - Storing an random size array in a mySQL column -



php - Storing an random size array in a mySQL column -

i have table. cointains 2 columns unique song , genre. unique song stores string, doesn't matter what.

genres contains array of strings (genres apply song), number of elements in strings beingness random (to big ditch array , create additional columns).

i know setup not work in mysql set up, need.

one way serialization, much able query out stone songs without having first querying them all, unserializing , finding match.

since of array contents of same type, there column back upwards such input? (int limited array of ints in way, no?)

you've got many-to-many relationship - 1 song can have multiple genres, , genre can used multiple songs.

create table called song, contains info song , unique identifier. sake of argument, we'll it's name of song: s_name.

create table called genre, contains info genres. maybe have genre, , info on style of music is.

finally, create table called songandgenre, that'll deed bridge table. it'll have 2 column - song id (in our case, s_name), , genre id (say, g_name). if song s has multiple genres g1 , g2, you'll have 2 rows song - (s, g1) , (s, g2).

php mysql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

ruby on rails - Devise Logout Error in RoR -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -