I am trying to make a query to MySQL that should bring data in a set date range and it does not work, if I could make other queries but it does not work, the data of the date range are two input type="date"
I show them the code:
<form action="/" method="POST">
<div class="row clearfix">
<div class="col-md-3">
<div class="form-group-horizontal">
<label class="control-label">Patente</label>
<input type="text" class="form-control" name="Numer">
</div>
</div>
<div class="col-md-3">
<h2></h2>
<button type="submit" class="btn bg-blue btn-lg-l-15 waves-effect">
<i class="material-icons">Buscar</i>
</button>
</div>
<!--/span-->
<div class="col-md-6">
<div class="form-group-horizontal">
<label class="control-label">Area</label>
<input type="text" class="form-control " placeholder="Area Responsable" name="area" id="area">
</small>
</div>
</div>
<!--/span-->
<!--/span-->
<div class="col-md-6">
<div class="form-horizontal">
<label class="control-label">Interno</label>
<input type="text" class="form-control form-control-danger" placeholder="Interno" name="interno" id="interno">
</small>
</div>
</div>
<!--/span-->
<!--/span-->
<div class="col-md-6">
<div class="form-horizontal">
<label class="control-label">Marca</label>
<input type="text" id="Marca" class="form-control form-control-danger" placeholder="Marca movil" name="marca" id="marca">
</small>
</div>
</div>
<!--/span-->
<div class="col-md-6">
<div class="form horizontal">
<label class="control-label">Fecha desde:</label>
<input name="Fechadesde" type="date" class="form-control" placeholder="dd/mm/yyyy" id="Date1" value="yyyy-MM-dd">
</small>
</div>
</div>
<div class="col-md-6">
<div class="form horizontal">
<label class="control-label">Fecha hasta:</label>
<input name="Fechahasta " type="date" class="form-control" placeholder="dd/mm/yyyy" value="yyyy-MM-dd" id="Date2">
</small>
</div>
</div>
</div>
</form>
And this is the driver code:
@app.route('/consultaxmovil.html', methods=['GET','POST'])
def consultaxmovil():
#patente = request.form.get("Numer",False)
Date1 = str(request.form.get("Fechadesde",False)).format("yyyy-MM-dd")
Date2 = str(request.form.get("Fechahasta",False)).format("yyyy-MM-dd")
#Date2.date().toString("yyyy-MM-dd")
cur1 = conn.cursor()
query ="SELECT * from tablaunion1 where Fecha_Carga between '"+ Date1 +"%' and '"+ Date2 +"%'"
cur1.execute(query)
var = cur1.fetchall()
return render_template('consultaxmovil.html', var=var)
cur1.close()