Hi,
Thanks for checking this out.
My goal is simple. Create a list of all the years that have had articles published in them (so basically every year). I have three unique dates in the date column, 2008-08-20, 2007-08-20, and 2006-08-20.
The code below only returns this as the print_r output;
Array ( [year] => 2008 )
$sql = "SELECT DISTINCT year(date) AS 'year' FROM news ";
$year_query = mysql_query($sql);
$years = mysql_fetch_assoc($year_query);
print_r($years);
foreach ($years as $year){
echo '<p>' .$year. '</p>';
}
Any help would be great as I have looked all over the net for this.
Thanks again.