Fetch today’s data using php mysql

There is different kinds of way for fetching data from database using php. We will use this way for fetching today’s data from database. Kindly follow strictly this steps:

$sql2 = "SELECT count(*) as total from scrap_post_archive WHERE page_section = 'trending' AND DATE(created_at) = DATE(NOW())";
$results = $conn->query($sql2);

$data=mysqli_fetch_assoc($results);
echo $data['total'];

 

 

 

Leave a Reply