Jump to content

array_unique from DB


praethorian

Recommended Posts

<?php @$result = mysql_query("SELECT MONTHNAME(FROM_UNIXTIME(date)) FROM ".TBL_NAME." ORDER BY date DESC") or die("Wrong query: " . mysql_error());

	$total = mysql_num_rows($result);
	if($total>0){

		for($i = 0; $i < $total; $i++){
			$row = mysql_fetch_array($result);
			 ?><a href="blog.php?month=<?php echo $row[0]; ?>" ><?php echo $row[0]; ?></a><br/><?php
		}//for
            }
?>

 

OUTPUT IS:

November

November

October

October

October

September

 

Anybody knows how get rid of the month name duplicity?

Just to print:

November

October

September

 

THX

 

 

Link to comment
https://forums.phpfreaks.com/topic/133494-array_unique-from-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.