Question
Create dynamic comma delimited list from table rows using PHP
I am trying to create a dynamic comma delimited list to
insert into a javascript music player. I've included the script
below, as well as my attempt. My problem is, it finds the sound
files fine, but then the track and artists names don't show. You
can see it here:
http://www.every-scene.com/artists2.php?recordID=1.
In the source code, it just shows a comma for the track and artists
names.
My second problem here is that when I concatenated the comma, one shows up at the end, which adds another "phantom" item. Is there a way to remove the last comma, or only show it only on the first items?
The database for this is currently set up on two tables, one for the song and directory, and one for the artist. The MySQL expression is: "SELECT music.trackdirectory, artists.artistname, music.trackname FROM music, artists WHERE music.artistID = artists.artistID". There are currently two songs: If I Had Eyes by Jack Johnson and Alone by Jack Johnson.
I have tried so many different things that I have found through searches, but nothing seems to solve all my issues. I believe the track and artist names aren't showing up becuuse you can only have one repeat region for each recordset on each page. I tried separating out the three into separate recordsets, but then the artist name doesn't coincide with the songs.
Can anyone help me piece all these issues together, I can see to find one solid answer to get it right. Thank you!
My second problem here is that when I concatenated the comma, one shows up at the end, which adds another "phantom" item. Is there a way to remove the last comma, or only show it only on the first items?
The database for this is currently set up on two tables, one for the song and directory, and one for the artist. The MySQL expression is: "SELECT music.trackdirectory, artists.artistname, music.trackname FROM music, artists WHERE music.artistID = artists.artistID". There are currently two songs: If I Had Eyes by Jack Johnson and Alone by Jack Johnson.
I have tried so many different things that I have found through searches, but nothing seems to solve all my issues. I believe the track and artist names aren't showing up becuuse you can only have one repeat region for each recordset on each page. I tried separating out the three into separate recordsets, but then the artist name doesn't coincide with the songs.
Can anyone help me piece all these issues together, I can see to find one solid answer to get it right. Thank you!
