0
When I filter in table no record appears. No error only no record appears.
I wanted to show you when to filter.
Could you help me?
Code:
<form method="POST">
Data Inicial <input name="datainicio" type = 'date'>
Data Final <input name="datafim" type = 'date'>
<input type="submit" class="button3" value="Buscar">
</form>
<?php
if(isset($_POST['datainicio']) && isset($_POST['datafim'])){
$datainicio=$_POST['datainicio'];
$datafim=$_POST['datafim'];
$query="SELECT * FROM custos WHERE (data>'$datainicio' AND data<'$datafim')";
$res=mysqli_query($ligacao,$query) or die(mysqli_error($ligacao));
?>
<p></p>
<table style="width: 100%;" border='0' name="table">
<thead>
<tr>
<th width="2%" align='center' bgcolor='#baba84'>Data</th>
<th width="5%" align='center' bgcolor='#baba84'>Nome do custo</th>
<th width="1%" align='center' bgcolor='#baba84'>Valor</th>
</tr>
</thead>
<tbody>
<?php
$total_valor = 0;
while($registo = mysqli_fetch_assoc($res)){
$valor=number_format($registo['valor'], 2, ',', ' ')."€";
echo '<tr>';
echo'<td align="center" bgcolor="white">'.$registo['data'].'</td>';
echo'<td bgcolor="white">'.$registo['nome_custo'].'</td>';
echo "<td bgcolor='white'>".$valor."</td>";
print ("<td bgcolor='white' width='1%'><a href='alterar_custos.php?num={$registo['num']}&data={$registo['data']}&nome={$registo['nome_custo']}&valor={$registo['valor']}' class='button2'><i class='fa fa-edit'></i></</a></td>");
print ("<td bgcolor='white' width='1%'><a href='eliminar_custos.php?num={$registo['num']}' class='button2'><i class='fa fa-trash'></i></</a></td>");
echo'</tr>';
$total_valor += $registo['valor'];
}
?>
</tbody>
<tfoot>
<tr>
<td align='left' colspan='2' bgcolor='#baba84'><b>Valor Total</b></td>
<td align='left' bgcolor='white'><?php echo number_format($total_valor, 2, ',', ' ')."€";?></td>
</tr>
</tfoot><!---->
</table>
<?php
mysqli_close($ligacao);
}
?>