Mysql
 SQL >> Database >  >> RDS >> Mysql

Ordinare e raggruppare per data

Si può scorrere il risultato ordinato per data e stampare un separatore quando cambia la data:

$previous_date = "";
while ($post = mysql_fetch_assoc($result)) {
  if ($post['post_date'] != $previous_date) {
    echo $post['post_date'];
    $previous_date = $post['post_date'];
  }
  echo "Post: {$post['title']}";
}