I have a code that fetches the data in the database and prints a table on the screen. My table that appears on the user's screen has the fields:
Referência | Abertura |Status |Objeto
Reference is an ID, Open is a date and time, Status is a string
and Object is a text.
This table above, searches the database for the "edicts" registered by the administrator, in another screen. On this screen of the edital register, I made another table in the database that registers the status it was and the status that it happened to be and to display and print on the screen when the user (adm) makes a Status change.
In the table that prints (above) the data that the user needs to know, I need the Status to sum this table after 30 days when it is changed to Not Successful or Revoked.
Since there were two different tables in the database, when I made select
I had to do a sub-select to bring the changed_status data and the last change date.
After that I made a if
to test if the status_changed has a date less than 30 days from today but did not work this way:
// $dados um mysql_fetch_array com o dados do select que eu fiz //
if ( ( $dados['status_alterado'] === "Sem Sucesso") && ( $dados['data'] <= date("m-d-Y") - 30) ) {
echo 'olar';
}
else {
echo 'oi';
}
I've done exactly this if
, however it always drops in else
, I already changed in the database a data that I entered as test today 03/25/2015 to 01/25/2015, but even then if
jumps to else
.