</div>
                <div class="yui-u">
                    <div id="class_div"></div><div id="level_div"></div><div id="race_div"></div>
                </div>
            </div>
        </div>
        <div id="ft" role="contentinfo"><p>Last update on <?php 
echo $date;
?>
</p></div>
    </div>
  </body>
</html><?php 
$short_name = 'kon_members-1';
ScraperWiki::attach($short_name, 'src');
$keys = ScraperWiki::sqliteexecute("select * from swdata limit 0")->keys;
$data = ScraperWiki::select("* from swdata");
$class = array("captain" => 0, "lore-master" => 0, "rune-keeper" => 0, "guardian" => 0, "minstrel" => 0, "hunter" => 0, "burglar" => 0, "champion" => 0, "warden" => 0);
$level = array('0-9' => 0, '10-19' => 0, '20-29' => 0, '30-39' => 0, '40-49' => 0, '50-59' => 0, '60-65' => 0);
$race = array('elf' => 0, 'race of man' => 0, 'hobbit' => 0, 'dwarf' => 0);
$rank = array('leader' => 0, 'officer' => 0, 'member' => 0);
$members = array();
foreach ($data as $i => $member) {
    $class[strtolower($member->class)]++;
    $race[strtolower($member->race)]++;
    $rank[strtolower($member->rank)]++;
    $lvl = intval($member->level);
    $range = $lvl - $lvl % 10;
    if ($lvl <= 10) {
        $st = 0;
        $en = 10;
#}
#https://scraperwiki.com/scrapers/campbelltown_city_council_development_proposals/edit/
#print_r($reports);
#if (isset($reports)){
#print "id" . $reports['id'];
#$existingreports = array();
#$existingreports = scraperwiki::sqliteexecute("select * from reports where `id`='" . $reports['id'] . "'");
#print_r($existingreports);
#    if (sizeof($existingreports) == 0)
#    {
#scraperwiki::sqliteexecute("drop table reports");
#scraperwiki::sqliteexecute("create table if not exists reports ('id' string, 'title' string, 'incidentdescription' string, 'incidentdate' string, 'incidentmode' string, 'incidentactive' string, 'incidentverified' string, 'locationid' string, 'locationname' string, 'locationlatitude' string, 'locationlongitude' string, 'categorytitle' string, 'categoryid' string, 'error' string, 'mediaid' string, 'mediatype' string, 'medialink' string, 'mediathumb' string, 'reporturl' string)");
foreach ($reports as $id => $values) {
    scraperwiki::sqliteexecute("insert or replace into reports values (:id, :title, :incidentdescription, :incidentdate, :incidentmode, :incidentactive, :incidentverified, :locationid, :locationname, :locationlatitude, :locationlongitude, :categorytitle, :categoryid, :error, :mediaid, :mediatype, :medialink, :mediathumb, :reporturl)", array("title" => $values["Title"], "id" => $id, "incidentdescription" => $values["Incidentdescription"], "incidentdate" => $values["Incidentdate"], "incidentmode" => $values["Incidentmode"], "incidentactive" => $values["Incidentactive"], "incidentverified" => $values["Incidentverified"], "locationid" => $values["Locationid"], "locationname" => $values["Locationname"], "locationlatitude" => $values["Locationlatitude"], "locationlongitude" => $values["Locationlongitude"], "categorytitle" => $values["Category"], "categoryid" => $values["CategoryID"], "error" => $values["Error"], "mediaid" => $values["MediaID"], "mediatype" => $values["MediaType"], "medialink" => $values["MediaLink"], "mediathumb" => $values["MediaThumb"], "reporturl" => $values["ReportURL"]));
}
#  $unique_keys = array("id");
#$table = "reports";
#if (isset($reports)){
#scraperwiki::save_sqlite($unique_keys, $reports, $table); #, $table
#}
#}
#   else
#  {
#       print ("Skipping already saved record " . $reports['id'] . "\n");
#   }
#Scraperwiki::sqliteexecute("select * from reports where `id`='" . $report['id'] . "'");
#if ScraperWiki::sqliteexecute("delete from reports where `title`='No data'");
ScraperWiki::sqliteexecute("delete from reports where `title`='No data'");
print "done";
scraperwiki::sqlitecommit();
#}