Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2006, 07:11 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to store selected songs ids in db?

Hi all i have a db for my music collection. It has one table with the following feilds on it:

Code:
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
 
Old February 21st, 2006, 03:03 AM
Authorized User
 
Join Date: Apr 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jmukesh Send a message via Yahoo to jmukesh
Default

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.










Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store and retrieve formatted strings in db jessi Classic ASP Professional 2 March 9th, 2007 07:27 AM
How to store textarea in a db? Hylsan PHP How-To 1 March 1st, 2007 07:51 AM
Parsing a BIG XML and store it in DB pravind XML 0 March 14th, 2006 06:35 AM
Parsing a BIG XML and store it in DB pravind XSLT 0 March 14th, 2006 05:50 AM
Store info into a MySQL DB table KoRn PHP How-To 1 February 17th, 2004 03:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.