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

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
JanMolendijk
Posts:282
Location:Holland Rotterdam

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

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];

?>

JanMolendijk Posts:282
I thought strange ??? But i had my date-code wrong ( :D sorry)

Code: Select all

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