On Mon, 3 Aug 2009 11:52:11 +0200, Nisse Engström wrote:
> You could use the date as an index:
>
> ... SELECT DATE(`datetimecolumn`) AS `date` ...
>
> while ($TrackingRow = mysql_fetch_object (...)) {
> $data[$TrackingRow['date']] = $TrackingRow;
> /* Store the last row from each set of dates */
> }
>
> or
>
> while ($TrackingRow = mysql_fetch_object (...)) {
> if (!isset ($data[$TrackingRow['date']])) {
> $data[$TrackingRow['date']] = $TrackingRow;
> }
> /* Store the first row from each set of dates */
> }
And, of course, if you want all rows to be indexed by date:
while ($TrackingRow = mysql_fetch_object (...)) {
$data[$TrackingRow['date']][] = $TrackingRow;
}
/Nisse
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php