I have the following query in my MYSQL DB, where what I do is show the ID and the start date of any request entered in my system.
SELECT id_formulario_1, DATE_FORMAT(fecha_solicitud, '%d-%m-%Y') as fecha_solicitud
FROM servicio_de_salud where id_formulario_1 = $fecha_inicio
What I would like to do, but I don't know how to do it, is to perform the same query but compare between the start date and the current date on the server. If the start date is less than 2 weeks, show it to me, I need this to view all the requests that are close to the current date and must be processed.
It seems to me that there is an error in the WHERE clause. Where it says id_form_1 = $fecha_inicio it should put date_request = $fecha_inicio.
However, to obtain the result you are looking for, the following queries could be useful:
or using the BETWEEN condition:
It would be with
INTERVAL 2 WEEK
but be careful because if you upload it to a hosting sometimes it does not give you the same time as your machine.