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"
Selecting Month from SQL Date
Moderator: General Moderators
-
foxtamerind
- Forum Newbie
- Posts: 3
- Joined: Mon Sep 20, 2010 9:46 am
Re: Selecting Month from SQL Date
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.