Page 1 of 1

Selecting Month from SQL Date

Posted: Mon Sep 20, 2010 9:53 am
by foxtamerind
I set up a database with phpMyAdmin where I have a table called "matches". A row inside the table called "match_date" uses the little date calendar thing to select a date. In my php Query I want it only to select the entries that have the current month. What should my $query look like to do such a thing?

Currently it looks like:

$query = "SELECT * FROM matches"

Re: Selecting Month from SQL Date

Posted: Mon Sep 20, 2010 10:17 am
by pickle
What's the format of the date field in your database? The easiest thing would be to update your "little calendar thing" to store the date in the MySQL DATE format. You could then use the MySQL MONTH() function.