Hi all , in my database there are rows of date in the form dd-mm-yyyy wat i want to do is? i want to leave a space after different years..ie if the table is 22-09-2004 06-06-2004 25-12-2005 03-02-2005 17-02-2008 it should be like this 22-09-2004 06-06-2004 25-12-2005 03-02-2005 17-02-2008 how will i compare the years using php code??
$res = mysql_query("SELECT EXTRACT(YEAR FROM jdate) AS year1 ,jdate FROM tablename") or die("Sql error: " . mysql_error()); while($row = mysql_fetch_array($res)) { $y1=$row["year1"]; if ($y2==$y1) echo $row["year1"] . "<br/>"; else echo $row["year1"] . "<br/><br/><br/>"; $y2=$row["year1"]; } }