topical media & game development
professional-sql-10-public-files-view.php / php
<?php
// include shared code
include '../lib/common.php';
include '../lib/db.php';
// determine current viewed month and year
_GET['t'])) ? month, timestamp));
// Javascript references
query = sprintf('
SELECT
POST_ID, POST_TITLE, POST_TEXT,
UNIX_TIMESTAMP(POST_DATE) AS POST_DATE
FROM
\%sBLOG_POST
WHERE
DATE(POST_DATE) BETWEEN
"\%d-%02d-01" AND
DATE("\%d-%02d-01") + INTERVAL 1 MONTH - INTERVAL 1 DAY
ORDER BY
POST_DATE DESC',
DB_TBL_PREFIX,
month,
month);
query, record = mysql_fetch_assoc(record['POST_TITLE'] . '</h2>';
echo '<p>' . date('m/d/Y', record['POST_TEXT'];
echo '<div style="display:none;" id="comments_' . record['POST_ID'] .
', this);return false;">Show Comments</a></p>';
echo '<hr/>';
}
mysql_free_result(query = sprintf('SELECT UNIX_TIMESTAMP(POST_DATE) AS POST_DATE ' .
'FROM \%sBLOG_POST ORDER BY POST_DATE DESC',
DB_TBL_PREFIX);
query, result))
{
// determine date of newest post
result);
row['POST_DATE'];
// determine date of oldest post
mysql_data_seek(result) - 1);
result);
row['POST_DATE'];
if (oldest)
{
echo '<a href="' . htmlspecialchars(timestamp) . '">Prev</a> ';
}
if (newest)
{
echo ' <a href="' . htmlspecialchars(timestamp) . '">Next</a>';
}
}
mysql_free_result(GLOBALS['TEMPLATE']['head_extra'] = '<link rel="alternate" ' .
'type="application/rss+xml" href=<rss.php> title="My Blog">';
echo '<p><a href=<rss.php>>RSS Feed</a></p>';
GLOBALS['DB']);
?>
(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.