$curdate="" while ($data = mysql_fetch_object($queryresults)) { if ($data->date != $curdate) { echo '<br>'.$data->date.'<br>'; $curdate = $data->date; } echo $data->post.'<br>'; }