// Copyleft under the terms of the GNU Public License
echo "
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 "
| ARTIST: | $artist [$artist_id] |
| Album: | Tracks: | Genre: | Year |
";
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 "| $title [$id] |
$count | $genre | $year |
";
}
echo "
";
} 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 "
| ARTIST: | $artist [$artist_id] |
| ALBUM: | $album [$discid] |
| Track | Title |
";
while ($song_row = mysql_fetch_array($result)) {
$track = $song_row["track_num"]+1;
$title = $song_row["title"];
$genre = $song_row["genre"];
echo "| $track | $title | $genre |
";
}
echo "
";
} 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 "
| GENRE: | $genre |
| Title | Tracks | Artist | Year |
";
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 "| $title [$id] |
$count | $artist [$artist_id] | $year |
";
}
echo "
";
} 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 "
| Search: | $string |
| Title | Artist | Album | Track | Genre | Year |
";
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 "| $title | $artist [$artist_id] |
$album [$disc_id] |
$track | $genre | $year |
";
}
echo "
";
} 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 "
| Artist: | Albums: |
";
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 "| $artist [$id] | $count |
";
// }
}
echo "
";
echo "Show the genres for which I have at least one album.
";
$sql = "SELECT distinct(genre) FROM disc";
$result = mysql_query($sql,$db);
echo "
| Genre: | Number |
";
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 "$genre | $count | ";
}
echo "
";
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.
";
}
echo "
All the information is initially gathered from the freedb database.
All CD's listed are from my own collection.
";
?>