检查sql提供的信息何时在php中更改[关闭]

I want to get a warning when a date is different like: enter image description here

I have a while and wanted to when it reaches to a different date, it warns me

$hist=mysqli_query($db, "SELECT * from history");
while($his=mysqli_fetch_assoc($hist)){

    If(certain_date != last_date){
        echo certain_date;
  }
}

Certain date and last date is the ones I wanna get

This is simply done like this

$hist=mysqli_query($db, "SELECT * from history");
$last_date = '';

while($his=mysqli_fetch_assoc($hist)){

    If($his['ano'] != $last_date){
        echo $his['ano'];
        $last_date = $his['ano'];
    }
}