Page 1 of 1

SELECT COUNT(*) WHERE date='$today'

Posted: 29 Oct 2017, 00:36
by JanMolendijk
Dear admin i try to add a counter but
i want to have the data from only
the current date into it...

This code is not working & what do i do wrong ???

Code: Select all

<?php 
  
include('connection.php');

$today = date('Y-j-n');

$result = $track->query("SELECT COUNT(*) FROM `visitor_tracker`  WHERE date='$today' ");
$row = $result->fetch_row();
echo 'Total Visits ', $row[0];

?>

SELECT COUNT(*) WHERE date='$today'

Posted: 29 Oct 2017, 01:26
by JanMolendijk
I thought strange ??? But i had my date-code wrong ( :D sorry)

Code: Select all

$today = date('Y-n-j');