
April 27th, 2003, 02:24 AM
|
|
Contributing User
|
|
Join Date: Oct 2002
Location: Washington, DC
Posts: 317
Time spent in forums: 2 m 3 sec
Reputation Power: 6
|
|
Ok - grab the results and build an array from the results, then loop and output the array:
PHP Code:
$query = "SELECT whatever FROM table ORDER BY date_column DESC";
/*****************************
Hit It
*****************************/
$result = mysql_query( $query, $resource_id ) or exit( 'Invalid Query: ' mysql_error() );
/*****************************
Get Results
*****************************/
$i = ( int )0;
while( $res = mysql_fetch_object ) )
{
/*****************************
Use Converted Tstamp For Key
*****************************/
$k = date( 'd F Y', $res->date_column );
/*****************************
Build Array
*****************************/
$dataset[$k][$i]['title'] = $res->news_title_column;
$dataset[$k][$i]['news'] = $res->news_post_column;
$dataset[$k][$i]['stamp'] = $res->date_column;
/*****************************
Increment Counter
*****************************/
$i++;
}
/*****************************
Loop And Output
*****************************/
foreach( $dataset as $key=>$val )
{
$day = strtotime( $key );
/***********************************
Output Your Table Header Here
***********************************/
echo( date( 'M j, Y', $day );
/***********************************
Now Loop Inner Array With Results
***********************************/
foreach( $val as $post )
{
/***********************************
Again, Table Crap
***********************************/
echo( 'Posted On: ' . date( 'M j, Y h:i', $post['stamp'] ) . '<br />' );
echo( $post['title'] . '<br />' );
echo( $post['news'] . '<br />' );
}
}
Untested and done quickly - but should give you what you want. Make sure you change your column names and sql stuff to reflect your DB structure...
|