professional-sql-09-public-files-img-chart.php / php
<?php include '../../lib/common.php'; include '../../lib/db.php'; include '../../lib/BarChart.php'; // get current month and year list(year) = explode('/', date('m/Y')); // determine which query to execute if (isset(// initialize arrays num_days = date("t", mktime(0, 0, 0, year)); for (i < i++) { i] = 0; i] = colors[// retrieve total hits query = sprintf(' SELECT DAY(ACCESS_TIME) AS ATIME, COUNT(IP_ADDRESS) AS TOTAL FROM\ %sSITE_ACCESS WHERE DATE(ACCESS_TIME) BETWEEN "\ %d-%02d-01" AND "\ %d-%02d-01" + INTERVAL 1 MONTH - INTERVAL 1 DAY GROUP BY ATIME ORDER BY ATIME ASC', DB_TBL_PREFIX, month, month); query, row = mysql_fetch_assoc(data[row['TOTAL']; } mysql_free_result(_GET['month'])) { // initialize arrays for (i < 13; data[labels[i)); i] = array('r' => 0xCC, 'g' => 0x33, 'b' => 0x33); } // retrieve total hits\ %sSITE_ACCESS WHERE DATE(ACCESS_TIME) BETWEEN "\ %d-01-01" AND "\ %d-12-31" GROUP BY ATIME ORDER BY ATIME ASC', DB_TBL_PREFIX, year, result = mysql_query(GLOBALS['DB']); while (result)) { row['ATIME']] = result); } else { die(); } // present bar chart chart->graphData(colors, chart->flushImage(); ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.