As the title says I am trying to make a query for a range of dates to the database 'Facilities', to the table 'PROYECTOF' to the field called 'Date' But I do not have much idea of how to do it since I am starting with php. My HTML code is as follows:
<td colspan="2">DESDE:<input type="date" id="fechai" style="border-radius:7px" ><br><br>HASTA:<input type="date" id="fechaf" onchange="submit" style="border-radius:6px" >
<input type="hidden" id="form_sent" name="form_sent" value="true">
<input type="submit" name="btn_submit" value="Enviar">
</td>
<?php
if(isset($_POST ['form_sent']) && $_POST ['form_sent'] =="true"){
$fechai=$_POST['fechai'];
$fechaf= $_POST['fechaf'];
$consultaf = $conexion->query("SELECT * FROM INSTALACIONES.PROYECTOF WHERE estado='FIN' OR estado='COT1' OR estado='OK1' AND fecha BETWEEN '$fechai' AND '$fechaf' ORDER BY FECHA DESC");
while($filaf = $consultaf->fetch_array())
{
$fechas[$a] = $filaf['fecha'];
$a++;
}
}
?>
Maybe the PHP code is wrong because I've been guided by several tutorials but none in particular has made it clear to me how to make the query.