I have a table in MySQL , which stores the confirmations of my clients in my website, having as fields: id | cod_cliente | data
, being the date the main.
What I need is to group and return the result of the day.
Example:
Das 05/10/2017 | 80 confirmations
Das 06/06/2017 | 100 confirmations
<?php
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT COUNT(*) AS 'DATA' FROM 'confirmacao' WHERE 'ID_CLI' = 27001";
$result = $conn->query($sql);
$sql2 = "SELECT * FROM 'confirmacao' WHERE 'ID_CLI' = 27002 GROUP BY 'DATA' ORDER BY 'ID' DESC";
$result2 = $conn->query($sql2);
while($row2 = $result2->fetch_assoc()) {
echo $row2["DATA"];
echo "<br />";
}
while($row = $result->fetch_assoc()) {
echo $row["DATA"];
echo "<br />";
}
?>
But it does not return correctly. how to do this? Thank you.