// Connect to the database server
$dbcnx = @mysql_connect($host,$user,$password);
if (!$dbcnx)
{
echo( "
Unable to connect to the database server
");
exit();
}
// Select the database
if (! @mysql_select_db($database) )
{
echo( "
Unable to locate Lyrics database
");
exit();
}
?>
// get song albums and song titles
$result = mysql_query( "SELECT album.album_sequence,album_title,song_sequence,song_name,active
FROM album, songs
where album.album_sequence = songs.album_sequence and songs.song_sequence>0" );
if (!$result)
{
echo("
Error performing query: " . mysql_error() . "
");
exit();
}
// display album/songs in table on left
$album = "";
while ($row = mysql_fetch_array($result) )
{
// add album title
if (!$row["album_title"] == $album)
{
$album = $row["album_title"];
echo("");
}
// create link back to this page with album & song #
if ($row["active"] == 'Y')
{
echo "
";
echo $row["song_name"] . "";
echo("
");
}
else
{
echo("
" . $row["song_name"] . "");
echo("
");
}
}
?>