$db = mysql_connect("localhost", "chartuser", "chrt11SDxx");
mysql_select_db("audibl2",$db);
if(empty($ofs)) $ofs=0;
if(empty($pub) or $pub=="all") {
$getlist=mysql_query("select songnum, value from sbsgcharts order by value desc limit $ofs,100",$db);
}
elseif($pub=='indie') {
$getlist=mysql_query("select songnum, value from sbsgcharts where songnum like 'sg0%' order by value desc limit $ofs,100",$db);
}
elseif($pub=='integ') {
$getlist=mysql_query("select songnum, value from sbsgcharts where songnum like 'sg2%' order by value desc limit $ofs,100",$db);
}
elseif($pub=='vine') {
$getlist=mysql_query("select songnum, value from sbsgcharts where songnum like 'sg80%' order by value desc limit $ofs,100",$db);
}
elseif($pub=='imp') {
$getlist=mysql_query("select songnum, value from sbsgcharts where songnum like 'sg86%' order by value desc limit $ofs,100",$db);
}
else {
$getlist=mysql_query("select songnum, value from sbsgcharts order by value desc limit $ofs,100",$db);
}
$ofsb=$ofs+mysql_num_rows($getlist);
$ofn=mysql_num_rows($getlist);
$ofadd=$ofs+1;
if($get=mysql_fetch_row($getlist)) {
echo "Top Songs at AudibleFaith \n";
if (99 < $ofs) {
echo "Listing results $ofadd-$ofsb\n";
}
elseif ($ofn==100) {
echo "Listing results $ofadd-$ofsb\n";
}
else {
echo "\n";
}
echo "| Rank | Title | Artist | \n";
$i=$ofs+1;
do {
$gettitle=mysql_query("select title, artist from songs where songnum='$get[0]'",$db);
if ($got=mysql_fetch_row($gettitle)) {
do {
echo "| $i | $got[0] | $got[1] | \n";
}
while($got=mysql_fetch_row($gettitle));
}
$i++;
}
while($get=mysql_fetch_row($getlist));
echo " \n";
echo "| \n";
if (99 < $ofs) {
$ofp=$ofs-100;
echo "Previous Page\n";}
else {
echo "\n";}
echo " | \n";
if ($ofn==100) {
echo " Next Page\n";}
else {
echo "\n";}
echo " | \n";
echo " |