SELECT
*
FROM
`list`
WHERE
IF (
DAYOFMONTH(NOW() + INTERVAL 2 DAY) > DAYOFMONTH(NOW()),
DAYOFMONTH(close) BETWEEN DAYOFMONTH(NOW()) AND DAYOFMONTH(NOW() + INTERVAL 2 DAY),
(DAYOFMONTH(close) >= DAYOFMONTH(NOW()) OR DAYOFMONTH(close) <= DAYOFMONTH(NOW() + INTERVAL 2 DAY))
)
ORDER BY
`close`
DESC
$filters = [];
foreach($_GET as $key => $value) {
$filters[] = $key . ' = ' . $value;
}
$filter = implode(" and ", $filters);