Subject: How to store selected songs ids in db?
Posted By: method Post Date: 2/18/2006 6:11:00 AM
Hi all i have a db for my music collection. It has one table with the following feilds on it:

ID|filename|artist|album|title|track|comments|genre|seconds|filesize|bitrate


I already created pages that with checkboxes that user select indvidual songs and by click of play button it goes and plays those songs for me.

Now i created another button next to play that it supposed to write the selected songs to db and save the ids of slected songs.Note: i use song ids to pull indvidual songs from db to be played by my song player!

My problem is i do not how to design a few tables that keep track of selected songs for each user along with the name of playlist for each user!! In processs i do not want to modify my current table i just  want to add more tables to help me achive what i want. I be happy if an expert tell me how i can create tables that store play list(selected songs)info for each user and later i be able to query them easily in order to pull out playlist of each user.Thanks
Reply By: jmukesh Reply Date: 2/21/2006 2:03:22 AM
you can have a table called as  

"TblPlayList" with fileds

*playlistid ( primarykey )
 playlistname
 userid     ( foriegn key to user table )

will store the different playlist for each user.

Now there is one more table.

tblSongPlayList with fields

*id ( primarykey )
playlistid ( foriegnkey to TblPlayList )
songid ( foriegnkey to tblSongs )

so we have 2 tables one stores the playlist and the other stores songs selected
in the playlist.

with an simple inner join you can always fetch song selected in playlist for a particular user.

Query: " select songid from tblSongPlayList where playlistid = xxxx ";
         

Regards
jmukesh.






Go to topic 40351

Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360
Return to index page 359
Return to index page 358
Return to index page 357
Return to index page 356
Return to index page 355