SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script problem : please help !

    Hi there.

    Basically, I dunno if you saw my "arrays and all that mess" post but I am having a problem with a script. I've decided to re-write it so as to make it a bit simpler !

    This is what I want to do :

    I have a releases table, which contains the name, price etc of a set of CD releases. These CDs can be 1,2,3 or 4 disks. Each release is stored in it's own row, with a unique ID.

    I have a track listing table, which contains the track listings, surprisingly. Here there are following columns : -

    - track_name
    - track_url (an optional link to a real audio clip)
    - ID (links to the relevant ID in the releases table)

    There are others, but not essential to this problem.

    WHAT I NEED TO DO :
    Is to be able to add the track_url field to certain tracks off certain CDs.

    i.e in the admin panel, the user clicks on "add track links to this CD" and all of the tracks from the relevant CD appear in a list, with textboxes next to them allowing for entry of a URL if the user wishes.

    I had basically achieved this before, but my problem was that it only seemed to be adding tracks if they were on the LAST CD of the set (ie disk 4 if it was a 4 disk set, or disk 3 if it was a 3 disk set).

    Can anyone give me some pointers?

    I know that was a long post, but i urgently need some help and advice.

    Thanks in advance,
    James

  2. #2
    SitePoint Zealot Alarion's Avatar
    Join Date
    May 2001
    Location
    Virginia
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, I am tired now and this might not be the best time to answer, but here goes

    First off, you need to pass the "ID" of the track. Looking at what you posted, this is the apparent layout of the "tracks" table:
    Code:
    Table_tracks
    -----------------------
    track_name
    track_URL
    release_ID
    the problem here, is you don't have a unique identifier in that table. granted, you could put a primary key on track_name AND release_ID, but it would be much easier to just add a column called "track_id" that auto_increments.

    now, what you can do, is pass the ID of the release in the link, which I am assuming you are allready doing.

    Now, you create a form with a bunch of textboxes for each URL. I would reccomend naming them something like:

    txt_Track_Url and append the track ID to the end so you would have "txt_track_url1" "txt_track_url32" etc etc

    then when you submit the form for updating, you can easily loop through the id's and update them.

    Sorry if that's not very coherent, like I said I am quite tired but I saw no one responded to ya yet

    If you need a full fledged example, I might be able to cook something up when I have some free time at work tomorrow.
    -=Alarion=-
    Protollix - Linux hosting from $3.95/m

  3. #3
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there.

    Thanks for the reply, but why would I want a primary key in that table ? The whole idea is that there could be 20 tracks from one CD - ie all of their ID column = 20 so it is linked to the relevant release in the releases table.

    Thanks,
    James

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    James, I'm finding it hard to pick up what the problem is. Can you give us a link to the other thread you mentioned or explain a bit more.

    Just in terms of what I think I understand - What is a release exactly? You say that a release is a set of CDs so is this like a Box set? Or is a release of several CDs bundled together a unique product in itself? Basically, what I'm thinking is that if a record company sells it, and a retail shop sells it, then there must be a standard already devised that covers how these things are classified and cataloged. No?

    As I said, the technical specifics of your problem I am failing to understand


  5. #5
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah this is for a record company.

    The releases are the seperate CDs - just like you can buy a double CD , some are 3 /4 cd box sets.

    the otehr thread is here

    http://www.sitepointforums.com/showt...threadid=24442

    thanks
    j

  6. #6
    SitePoint Zealot Alarion's Avatar
    Join Date
    May 2001
    Location
    Virginia
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, every record in every table should be uniquely identifieable (sp).

    Like I said, you could make the primary key a combination of Release ID and Track Name. I just find it easier to use id's for almost everything.. *shrugs*
    -=Alarion=-
    Protollix - Linux hosting from $3.95/m

  7. #7
    SitePoint Member Whatever5476's Avatar
    Join Date
    Jun 2001
    Location
    Toronto
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    perhaps each CD in a set should have their own ID, so when u add tracks you're adding to the specific CD in the set; or, you could add a column called CD_Number to indicate which CD in the set you're refering to, and make CD_ID and CD_Number primary key.

    i would agree with James to add an column called "track_id" so it will be easier for maintenance.

    hope this helps...
    Enjoy Life...

  8. #8
    SitePoint Member Whatever5476's Avatar
    Join Date
    Jun 2001
    Location
    Toronto
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops... i meant, i would agree with Alarion
    sorry
    Enjoy Life...

  9. #9
    SitePoint Zealot Alarion's Avatar
    Join Date
    May 2001
    Location
    Virginia
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol

    personally, I would use three tables.

    one for releases
    one for CD
    one for track

    each release can have mutliple cd's, and each cd can have multiple tracks

    unless I misunderstood what you mean by "release"
    -=Alarion=-
    Protollix - Linux hosting from $3.95/m


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •