Hello!
What I'm trying to do is to display the number of events per day on a PHP calendar. The events are entered into my db with a column called 'diw_depdate' which contains a date in 'YYYY-MM-DD' format. Using the substr function, I was trying to display the correct # of events per day in the matching calendar day.
$query = "SELECT COUNT(*) FROM diw WHERE '.$Year.' = substr($diw_depdate,0,4) AND '.$Month.' = substr($diw_depdate,6,2) AND '.$calendar_day.' = substr($diw_depdate,9,2)";
$numdeps = mysql_query($query) or die("Select Failed!");
$numdep = mysql_fetch_array($numdeps);
With the above code I get this error:
Notice: Undefined variable: diw_depdate in c:\phpdev5\www\newtad\main.php on line 192
Select Failed!
I've never used the substr function before, and to me it's complicated when trying to use it in an MSSQL query.
Any guidance is much appreciated.