// Copyleft under the terms of the GNU Public License echo "

Discotheek

DDJ Discotheek browser
© 2002 Hugo van der Kooij <hugo@vanderkooij.org>
Copyleft under the terms of the GNU Public License.

"; $db = mysql_connect("192.168.1.1","ddj","ddj"); mysql_select_db("ddj_mp3",$db); if ($artistid) { // Toon albums van artiest echo "

Show all the albums I have for this artist/group/....

"; $sql = "SELECT id,artist FROM artist WHERE id=$artistid"; $artistrow = mysql_fetch_row(mysql_query($sql,$db)); $artist_id = $artistrow[0]; $artist = $artistrow[1]; $sql = "SELECT id,title,genre,year FROM disc WHERE artistid=$artistid ORDER BY title"; $result = mysql_query($sql,$db); echo ""; while ($discrow = mysql_fetch_array($result)) { $title = $discrow["title"]; $id = $discrow["id"]; $sql = "SELECT count(id) FROM song WHERE discid=$id"; $countrow = mysql_fetch_row(mysql_query($sql,$db)); $count = $countrow[0]; $genre = $discrow["genre"]; $year = $discrow["year"]; echo ""; } echo "
ARTIST:$artist [$artist_id]
Album:Tracks:Genre:Year
$title [$id] $count$genre$year
"; } elseif ($discid) { // Toon inhoud van album $sql = "SELECT artist FROM artist WHERE id=$artist_id"; $artistrow = mysql_fetch_row(mysql_query($sql,$db)); $artist = $artistrow[0]; $sql = "SELECT title FROM disc WHERE id=$discid"; $disc_row = mysql_fetch_row(mysql_query($sql,$db)); $album = $disc_row[0]; $sql = "SELECT title,track_num,genre,year FROM song WHERE discid=$discid ORDER BY track_num"; $result = mysql_query($sql,$db); echo ""; while ($song_row = mysql_fetch_array($result)) { $track = $song_row["track_num"]+1; $title = $song_row["title"]; $genre = $song_row["genre"]; echo ""; } echo "
ARTIST:$artist [$artist_id]
ALBUM:$album [$discid]
TrackTitle
$track$title$genre
"; } elseif ($genre) { // Toon alles uit het genre echo "

Show all the albums for this genre.

"; $sql = "SELECT id,title,year,artistid FROM disc where genre=\"$genre\" ORDER BY title"; $result = mysql_query($sql,$db); echo ""; while ($discrow = mysql_fetch_array($result)) { $title = $discrow["title"]; $id = $discrow["id"]; $sql = "SELECT count(id) FROM song WHERE discid=$id"; $countrow = mysql_fetch_row(mysql_query($sql,$db)); $count = $countrow[0]; $artist_id = $discrow["artistid"]; $sql = "SELECT artist FROM artist WHERE id=$artist_id"; $artistrow = mysql_fetch_row(mysql_query($sql,$db)); $artist = $artistrow[0]; $year = $discrow["year"]; echo ""; } echo "
GENRE:$genre
TitleTracksArtistYear
$title [$id] $count$artist [$artist_id]$year
"; } elseif ($string) { // Toon zoekoplossingen $sql = "SELECT title,artistid,discid,genre,year,track_num FROM song WHERE title LIKE \"%$string%\" ORDER BY title"; $result = mysql_query($sql,$db); echo ""; while ($row = mysql_fetch_array($result)) { $title = $row["title"]; $artist_id = $row["artistid"]; $sql = "SELECT artist FROM artist WHERE id=$artist_id"; $artistrow = mysql_fetch_row(mysql_query($sql,$db)); $artist = $artistrow[0]; $disc_id = $row["discid"]; $sql = "SELECT title FROM disc WHERE id=$disc_id"; $disc_row = mysql_fetch_row(mysql_query($sql,$db)); $album = $disc_row[0]; $track = $row["track_num"]+1; $genre = $row["genre"]; $year = $row["year"]; echo ""; } echo "
Search:$string
TitleArtistAlbumTrackGenreYear
$title$artist [$artist_id] $album [$disc_id] $track$genre$year
Search string:
"; } else { // Toon artiesten lijst echo "

Main menu


"; echo "

Show the artists/groups/.... from whom I have at least one album.

"; $sql = "SELECT id,artist FROM artist ORDER BY artist"; $result = mysql_query($sql,$db); echo ""; while ($artrow = mysql_fetch_array($result)) { $artist = $artrow["artist"]; $id = $artrow["id"]; $sql = "SELECT count(id) FROM disc WHERE artistid=$id"; $countrow = mysql_fetch_row(mysql_query($sql,$db)); $count = $countrow[0]; // if ($count != 0) { echo ""; // } } echo "
Artist:Albums:
$artist [$id]$count

"; echo "

Show the genres for which I have at least one album.

"; $sql = "SELECT distinct(genre) FROM disc"; $result = mysql_query($sql,$db); echo ""; while ($genre_row = mysql_fetch_row($result)) { $genre = $genre_row[0]; $sql = "SELECT count(id) FROM disc WHERE genre=\"$genre\""; $countrow = mysql_fetch_row(mysql_query($sql,$db)); $count = $countrow[0]; echo ""; } echo "
Genre:Number
$genre$count

"; echo "

Search for a particular song with the following search form. It is not case sensitive and can search for any part of the song title.

Search string:
"; } echo "

All the information is initially gathered from the freedb database. All CD's listed are from my own collection.

"; ?>