tags:

views:

23

answers:

3

I need to display a list of dates from a database. There can be multiple records with the same date, but I only want the date to display once.

In other words, I need to only display unique dates. Any ideas?

+1  A: 

Have you tried using DISTINCT in your sql query?

This would have been perfect, but I forgot to mention that they're unix timestamps. Thank you so much!
A: 

You can build an array with the date as a key. And the results in tere.

$return = array();

foreach ($results as $result) {
    $return[$result['data']][] = $result;
}

where $return is an array with unique dates as a key.

Ronn0
A: 

If your dates are formatted the same you could build an array directly and use array_unique().

http://us3.php.net/manual/en/function.array-unique.php

qnrq