help with mySQL select where dates >= todays date?



I have a DB that has the date entered in three fields.
Month (long form like february)

With these three fields how can I do a select where the some function to combine these three fields is >= todays date?

thanks for any help

For doing this, first of all you have to extract the current date's day, month and year into seprare variable's

$date=date("Y-m-d"); // Would retrive the current date.

$date=explode("-",$date); //break the date detail into the array.


Now you can write your query as following.

select * from db where year>$year and month>$month and day>$day

I hope this would work for you.

if you get any problem then please dont hasitate to ask again and again.

Vikas Garg
Thanks for the reply. I have one small problem

In the Select statemen the part where month>$month

month = 'April' and $month=04

How do I fix this?

Thanks so much for you help
i have a date thing like that, i used one field for the date. in mysql you set the field type to date, and you enter your date in the y-m-d format, like 2003-04-14. then you can have...

$today = date( "y-m-d");
SELCT fields FROM table WHERE date>=$today

Then when displaying the date, you can manipulate it display anything that a timestamp can do.

$date = strtotime ($myrow["date"]);
$formatdate = date('d-M',$date);
myrow is the array that was fetched. strtotime converts dates into a timestamp, then the date function formats it. To see all the ways you can format the date, or time view the date function properties on