In my bank I have the field with datetime current_timestamp in the access table. I need to display the amount that each device accessed the site, whether computer, ios or android, each time one of them accesses, the corresponding field receives 1, so I need to count on the day how many times the site has gained access from each device, problem is: how do I convert the datetime in the query to compare only the date without the hour? I did it that way but it worked yesterday, but the access data was from yesterday, today it's already been a problem.
<?php
$select= "SELECT distinct CAST(data_acesso AS DATE) FROM tbl_acesso";
$result_select= $conn->query($select);
while($col = mysqli_fetch_assoc($result_select)):
$data = $col['data'];
$data_create = date_create($data);
$data_format = date_format($data_create, "Y-m-d");
//selecionando site
$selectSite = "SELECT site FROM tbl_acesso WHERE CAST(data_acesso as DATE) = '$data_format' AND site IS NOT NULL ";
$resultadoSite = $conn->query($selectSite);
$site = mysqli_num_rows($resultadoSite);
//selecionando ios
$selectIos = "SELECT ios FROM tbl_acesso WHERE CAST(data_acesso as DATE) = '$data_format' AND ios IS NOT NULL";
$resultadoIos = $conn->query($selectIos);
$ios = mysqli_num_rows($resultadoIos);
//selecionando android
$selectAndroid = "SELECT android FROM tbl_acesso WHERE CAST(data_acesso as DATE) = '$data_format' AND android IS NOT NULL";
$resultadoAndroid = $conn->query($selectAndroid);
$android = mysqli_num_rows($resultadoAndroid);
?>