Reply to Re: Pulling tracklists from album db

Your name:

Reply:


Posted by Jim Hernandez on 11/05/05 00:41

Andreas Edin wrote:
> Jim Hernandez wrote:
>
>
>>I'm setting up a database for albums and I've decided to break the
>>tracklist down track by track in the table, i.e., albumkey (primary)
>>atitle
>>aartist
>>alabel
>>track1
>>track2
>>track3
>>track4... on through track 30.
>>I want to call the tracks via php form the database and put them into
>>a sidebar on a webpage. Say the db has room for 30 as mine does but
>>the album only has 14 tracks, how do I communicate to sql to pull
>>until the tracks are null and stop.
>>
>>Thanks for any help or advice
>
>
> In this case the easiest way is to create two table's.
> One with the album and the other one with the correspondent tracks.
>
> Example:
> Table1:
> id <--- this field is the uniqe field
> album
> atitle
> artist
> alabel
>
> Table2:
> id ---> is the same as the album id
> ---> but in this table it's not a uniqe value, it's an integer
> trackname
>
> For each track you insert a new record in table 2.
>
> Then when you want to create an output från this you just makes
> two itterations. The first one is on table1, where you can sort it as
> you like by albumname, title or label.
>
> For each record in table1 you select all with the same correspondent
> number in table2.
>
> I hope this gave you some hint where to start.
> Andreas Edin, Sweden
>
>
>
>
>
>
so in table 2 itd be
id1 track 1 name
id1 track 2 name
id1 track 3 name
id1 track 4 name

or

track 1 track 2 track 3 track 4
id1 name name name name
id2 name name name name

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация