Greetings,
I am trying to select only the month a record was created from the database format 2002-10-6 and only return the items created in october.
I've tried using several different ways of doing date('m'); but so far no luck. Any help appreciated.
Rab
Let mySQL do the work... Try something like :
mysql_query("SELECT * FROM mytable WHERE datefield LIKE '%-10-%'");
Thanks! I hadn't even considered that option.
You'll get Oct from ALL years with that statement. Jeff
Ok - It's not rocket science:
$selyear = 2002; $selmon = 10;
mysql_query("SELECT * FROM mytable WHERE datefield LIKE '$selyear-$selmon-%'");