I'm trying to retrive a list of months in a database, but i only want a list of each month and not a list of every accurance, not sure where i'm going wrong, its some logic issue i can't seem to wrap my head around $q = "SELECT created FROM post ORDER BY created DESC;"; $r = mysql_query($q); print '<ul>'; while($row = mysql_fetch_assoc($r)){ extract($row); $year = date("Y", strtotime($created)); $month = date("F", strtotime($created)); print '<li>'.$month.'</li>'; } print '</ul>'; PHP: which results in: January January January January January February February February February March March instead of: January February March