0
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 gets 1, so I need to count on the day how many times the site got access from each device, problem is: how do I convert datetime into query to compare only date without time? I did that way but it worked yesterday, but the access data were yesterday, today already gave 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);
?>
you better remove that edit and add an answer.. so you can mark it as accepted and the question is not open
– rLinhares
got it, I’m gonna do it
– Caio Brandão