The timestamps in my db are stored as integers. The query below retrieves them and formats them the way I'd like, but I can't figure out how to ensure that only unique month / year values are printed. Right now, it'll print:
May 2009
May 2009
June 2009
June 2009
June 2009
When, I only want it to print:
May 2009
June 2009
Here's the sql / code I'm using:
$sql = "select nid, DATE_FORMAT((FROM_UNIXTIME(n.created) + INTERVAL -18000 SECOND), '%M %Y') as printed_value from mytable";
if ($result = db_query($sql,$vars)) {
while ($arr = db_fetch_array($result)) {
print '<h2>Archives</h2><br /><a href="/blog/'.$arr['nid'].'">'.$arr['printed_value'].'</a><br />';
}
}