<?
$usr = "database_username";
$pwd = "database_password";
$db = "samdb";
$host = "database_server_ip";
$sqlCon = mysql_connect($host, $usr, $pwd);
mysql_select_db("database_name");
if (!$sqlCon) { echo("ERROR: " . mysql_error() . "\n"); }
// GET THE CURRENTLY PLAYING SONG INFO
$curPlay = mysql_query("SELECT * FROM historylist ORDER BY date_played DESC LIMIT 1");
$curPlayRow = mysql_fetch_assoc($curPlay);
if (!$curPlay) { echo( mysql_error()); }
// RECENTLY PLAYED
$recentPlayed = mysql_query("SELECT * FROM historylist ORDER BY date_played DESC LIMIT 6");
$recentPlayedRow = mysql_fetch_assoc($recentPlayed);
if (!$recentPlayed) { echo( mysql_error()); }
?>
<html>
<head>
<title>Title of this Page</title>
</head>
<body>
<? echo $curPlayRow["artist"] . " - " . $curPlayRow["title"]; ?>
<table>
<? while ($recentPlayedRow = mysql_fetch_assoc($recentPlayed)) { ?>
<tr>
<td><? echo $recentPlayedRow["artist"] . " - " . $recentPlayedRow["title"] ?></td>
</tr>
<? } ?>
</table>
</body>
</html>
<? mysql_close($sqlCon); ?>