include getenv("DOCUMENT_ROOT")."/omdb/omdb.php"; ?>
$PROTECT=new protect(0);
$USER=$PROTECT->USER;
$navPath=array("stats");
$SEO["title"]="statistics about what hot buttered rum has played, when, and how";
function decPlaces($num,$places) {
return round($num*pow(10,$places))/pow(10,$places);
}
?>
include getenv("DOCUMENT_ROOT")."/inc/header.php"; ?>
// SHOWS PER YEAR
// 86400 = seconds in a day
$rs=new rs("select count(*) as cnt, (unix_timestamp(max(showdate)) - unix_timestamp(min(showdate)))/86400 as days from shows;");
$rs->popOneRecord();
$NUMSHOWS = $rs->record["cnt"];
$NUMDAYS = $rs->record["days"];
$rs=new rs("select distinct(shows.id) as cnt from shows, showsets, setsongs where setsongs.showset=showsets.id and showsets.showid=shows.id;");
$NUMSHOWSWSETLIST = $rs->length;
$rs=new rs("select distinct(showsets.id) as cnt from showsets, setsongs where setsongs.showset=showsets.id and showsets.isencore!=1;");
$NUMSETSWSONGS = $rs->length;
// SONGS PER SET
$rs->query("select count(*) as setcnt from showsets where showsets.isencore!=1;");
$rs->popOneRecord();
$NUMSETS = $rs->record["setcnt"];
$rs->query("select count(*) as sngcnt from showsets, setsongs where showsets.isencore!=1 and setsongs.showset=showsets.id;");
$rs->popOneRecord();
$NUMSETSONGS = $rs->record["sngcnt"];
// SONGS PER ENC
$rs->query("select count(*) as setcnt from showsets where showsets.isencore=1;");
$rs->popOneRecord();
$NUMENCS = $rs->record["setcnt"];
$rs->query("select count(*) as sngcnt from showsets, setsongs where showsets.isencore=1 and setsongs.showset=showsets.id;");
$rs->popOneRecord();
$NUMENCSONGS = $rs->record["sngcnt"];
?>
| total Shows: |
= $NUMSHOWS; ?> (= $NUMSHOWSWSETLIST." with setlists available"; ?>) [show stats] |
// SHOWS BY YEAR
$rs->query("select Date_Format(showdate,'%Y') as y, count(date_format(showdate,'%Y')) as cnt from shows group by y order by y;");
$rs->records=array();
$rs->popRecords("y");
$YRSHOWS = $rs->records;
?>
shows per year: |
Average: = decPlaces($NUMSHOWS / ($NUMDAYS/365),2); ?> (= $NUMSHOWS." shows over ".decPlaces(($NUMDAYS/365),1)." years"; ?>)
foreach($YRSHOWS as $k=>$item) { print $k.": ".$item["cnt"]." (".decPlaces(($item["cnt"]/$NUMSHOWS)*100,1)."%) "; } ?> |
// SHOWS BY MONTH
$rs->query("select Date_Format(showdate,'%m') as i, Date_Format(showdate,'%M') as m, count(date_format(showdate,'%M')) as cnt from shows group by m order by i;");
$rs->records=array();
$rs->popRecords("m");
$MONSHOWS = $rs->records;
?>
shows by month: |
foreach($MONSHOWS as $k=>$item) { print $k.": ".$item["cnt"]." (".decPlaces(($item["cnt"]/$NUMSHOWS)*100,1)."%) "; } ?> |
// SHOWS BY DAY OF THE WEEK
$rs->query("select Date_Format(showdate,'%w') as i, Date_Format(showdate,'%W') as w, count(date_format(showdate,'%W')) as cnt from shows group by w order by i;");
$rs->records=array();
$rs->popRecords("w");
$DAYSHOWS = $rs->records;
?>
shows by day: |
foreach($DAYSHOWS as $k=>$item) { print $k.": ".$item["cnt"]." (".decPlaces(($item["cnt"]/$NUMSHOWS)*100,1)."%) "; } ?> |
// STATES
$rs->query("select count(distinct(venues.state)) as cnt from venues, shows where shows.venue=venues.id;");
$rs->records=array();
$rs->popOneRecord();
$NUMSTATES = $rs->record["cnt"];
?>
states/territories: |
= $NUMSTATES; ?> [state stats] |
// VENUES
$rs->query("select count(distinct(shows.venue)) as cnt from shows;");
$rs->records=array();
$rs->popOneRecord();
$NUMVENUES = $rs->record["cnt"];
?>
venues: |
= $NUMVENUES; ?> [venue stats] |
| sets per show: |
= decPlaces($NUMSETSWSONGS/$NUMSHOWSWSETLIST,2); ?> (= $NUMSETSWSONGS." sets in ".$NUMSHOWSWSETLIST." shows"; ?>) |
| encs per show: |
= decPlaces($NUMENCS/$NUMSHOWSWSETLIST,2); ?> |
$origs=new songs(0);
$origs->searchFields["nonhbrwriter"]=array("","=");
$NUMORIGS=$origs->getAll();
$covers=new songs(0);
$covers->searchFields["nonhbrwriter"]=array("","!=");
$NUMCOVERS=$covers->getAll();
?>
songs: |
= $NUMSONGS=($NUMORIGS+$NUMCOVERS); ?> [song stats]
originals: = $NUMORIGS; ?> (= decPlaces(($NUMORIGS/$NUMSONGS)*100,2); ?>%)
covers: = $NUMCOVERS; ?> (= decPlaces(($NUMCOVERS/$NUMSONGS)*100,2); ?>%) |
| songs per show: |
= decPlaces(($NUMSETSONGS+$NUMENCSONGS)/($NUMSHOWSWSETLIST),2)." (".($NUMSETSONGS+$NUMENCSONGS)." songs played in ".($NUMSHOWSWSETLIST)." shows with setlists)"; ?> |
| songs per set: |
= decPlaces($NUMSETSONGS / $NUMSETSWSONGS,2)." (".$NUMSETSONGS." songs played in ".$NUMSETSWSONGS." sets)"; ?> |
| songs per encore: |
= decPlaces($NUMENCSONGS / $NUMENCS,2)." (".$NUMENCSONGS." songs played in ".$NUMENCS." encores)"; ?> |
include getenv("DOCUMENT_ROOT")."/inc/footer.php"; ?>