Is it possible to read x number of chars in a PHP string? Here is my problem:
I want to set MySQL's NOW() to a PHP variable:
$year = 'Select NOW()'
then read the first four chars of that variable to get the year. This is for my website that will track fiscal quarters for clients. And since this will be ongoing, year after year, I really don't want to hard-code the year in my query:
"SELECT SUM(balances) FROM fiscalTable WHERE date BETWEEN `2015-01-01` AND `2015-03-30`"
If I did it that way, I'd have to remember to change it yearly, etc.
What I'd rather do, if it's possible, is read the first four chars from the var $year that I set above. If I cld do that, then my code wld be once and done. Any suggestions, Forum?