I want to change the status of all the records according to the current date automatically, but the following code updates all the data according to the first record
include('php/connection.php');
$hoy = date('Y-m-d');
$sql = "select * from agenda";
$edit = mysql_query($sql,$cn);
$row = mysql_fetch_array($edit);
$fecDB = $row['fecha_fin'];
if($fecDB<$hoy)
{
$estado = "VENCIDO";
}
elseif ($fecDB>=$hoy)
{
$estado = "EN PROCESO";
}
$sql = "update agenda set estado='$estado' where (fecha_fin<'$hoy') OR ".
"(fecha_fin>='$hoy')";