I'm a noob so this might be an obvious one to most, but here goes...
One of my tables holds a date field (yyyy-mm-dd) on each row. I want to query the table and only retrieve rows where the month matches a passed in variable.
Can I use the substr function within my sql query? I was thinking I'd need to do something like this, but I can't seem to get it to work...
$v = '09' // just as an example
"SELECT SUBSTR(date, 4, 2) AS date, firstname, lastname, FROM mytable WHERE date = '$v'"
TIA
Sol