Very good,
I have a query that is generated by making a selection by means of a <select>
.
In the <select>
you have to choose the month and the year, and send the variables to a query where you extract the data for that particular month. It works correctly!
The problem is that I would like to do the same but obtain the data of 1 quarter. The year has 4 quarters, so in my <select>
there will be 4 options: "1 Quarter", "2 Quarter", etc ...
In the code I check the $trim
to assign a range of dates so that later I can check it. But it does not work for me.
I update the code according to the help received:
if (isset($_POST['enviar'])) {
$trim=$_POST['trim'];
$anno=$_POST['ano'];
if ($trim == '1'){
$FechaInicio = $anno."-01-01";
$FechaFin = $anno."-04-01";
}
}
$sql_a=mysqli_query($con, "SELECT * FROM facturas,clientes
WHERE facturas.id_cliente=clientes.id_cliente
AND estado_factura=2
AND facturas.fecha_factura BETWEEN '$FechaInicio' AND '$FechaFin'");
Thank you very much!