change status "active" to "inactive" automatically php

-2

I need the "active" state to automatically change to the "inactive" state when the current date is longer than the deadline (when it is due).

I do not have the code with me but you could help me an example.

I would appreciate a lot.

    
asked by lina salazar 20.11.2018 в 03:28
source

1 answer

1
$fecha_actual = strtotime(date("d-m-Y H:i:00",time()));
$fecha_limite = strtotime("20-11-2018 21:00:00");

$estado = true;
if($fecha_actual > $fecha_limite){
    $estado = false;
}

Or if you prefer you can serve this:

$fecha_actual = strtotime(date("d-m-Y H:i:00",time()));
$fecha_limite = strtotime("20-11-2018 21:00:00");

$estado = "activo";
if($fecha_actual > $fecha_limite){
     $estado = "inactivo";
}

I hope you get an idea

    
answered by 20.11.2018 / 03:51
source