0
I’m trying to list certain database columns by date but it doesn’t work.
Follows excerpt from the code:
<?php
if($_GET['busca'] == "data") {
$datai = date('Y/m/d', strtotime($_POST['data']));
$nome = $_POST['nome'];
$preco = $_POST['preco'];
$qtd = $_POST['qtd'];
$query = mysqli_query("SELECT data, nome, preco, SUM(preco) AS pr, SUM(qtd) AS qtd, date_format(data, '%d/%m/%Y') AS data FROM tbl_carrinho WHERE idGarcon='$garcon' AND data BETWEEN '$datai' AND '$dataf' AND time BETWEEN '$hora1' AND '$hora2' GROUP BY data") or die(mysqli_error());
}
while($resultado = mysqli_fetch_array($query)) {
$data = $resultado['data'];
$nome = $resultado['nome'];
$qtd = $resultado['qtd'];
$preco = $resultado['preco'];
?>
<tr style="border:1px solid #f2f2f2;">
<td align="center" style="border:1px solid #f2f2f2;"><?php echo $data ?></td>
<td align="left" style="border:1px solid #f2f2f2;"><?php echo $nome ?></td>
<td align="center" style="border:1px solid #f2f2f2;"><?php echo $preco ?></td>
<td align="center" style="border:1px solid #f2f2f2;"><?php echo $qtd ?></td>
</tr>
?>