Condo Unit Listing Tracker
Welcome to the VCI Condo Unit Listing Tracker. This index tracks the number of units currently for sale in a selection of new condo towers in the downtown Vancouver core. Rollover graph image for more information. This index is updated daily.
/*
coded by dmitry@dvinyaninov.com
*/
set_time_limit(0);
error_reporting(E_ALL);
include 'functions.php';
include 'settings.php';
include 'db_open.php';
if( $_GET['update']) {
$buildings = $db->queryAll(‘SELECT * FROM building LIMIT 100′, null, MDB2_FETCHMODE_ASSOC);
if( count($buildings) ) {
foreach($buildings AS $building) {
$bulding_page = getPage($building['url']);
if( preg_match(‘/
| ]*>|<\/th>/ims’,$listing); foreach($listing_header AS $column) { $column_name = trim(preg_replace(‘/[^\w]*/’,”,strip_tags(html_entity_decode($column)))); $header[] = strtolower($column_name); } } else { $listing_values = preg_split(‘/ | ]*>|<\/td>/ims’,$listing); $listing_sql_values = array(); foreach($listing_values AS $key=>$listing_value) { $listing_sql_values[$header[$key]] = $listing_value; } $sql = “REPLACE INTO listing $result = $db->query($sql); if ( PEAR::isError( $result ) ) { } $updated = $db->queryOne(“SELECT MAX(posted) AS updated FROM `listing`”); $maxpercent = $db->queryOne(“SELECT CONCAT(ROUND(count(*)/(units/100),2)) FROM listing l $stats = $db->queryRow(“SELECT count(*) AS for_sale, DATE_FORMAT(posted,’%d/%m/%Y’) AS today, SUM(DISTINCT units) AS total, ROUND(count(*)/(SUM(DISTINCT units)/100),2) AS percent FROM listing l $sql = “SELECT name AS ‘building’, url, units AS ‘total’, count(*) AS ‘for_sale’, CONCAT(ROUND(count(*)/(units/100),2),’%') AS percent $items = $db->queryAll($sql, null, MDB2_FETCHMODE_ASSOC); include ‘db_close.php’; ‘; ‘; echo ‘ ‘; ‘; $config['height'] = ’200′; echo ‘ Current listings as of ‘.$stats['today'].’: ‘.$stats['for_sale'].’ of ‘.$stats['total'].’ existing units(‘.$stats['percent'].’%) ‘; |
|---|
‘;
}
else {
echo ‘no data’;
}
?>
The code for the C.U.L.T. index was donated to the VCI Community by c0der, the same programmer who built the comment rating system used on this site. c0der is a Vancouver based Systems Architect working with Linux, Security, Oracle Fusion and PHP/MySQL technology stacks. If you have a project you’d like him to consult or program for you can email him directly: coder@vancouvercondo.info.
‘;