Jump to content

PHP MySQL and DATE


common

Recommended Posts

Hi everyone

 

I have a databse and in one of the columns I have date values such as 2009-March-27. If i have a php interface and want to use a query to select all the rows that is in say october. how would the query look like?? Because i know how to check the whole date, but I want a query that only checks the months... Please help!

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/179720-php-mysql-and-date/
Share on other sites

If your database column was of type date then you could have used something like...

 

SELECT * FROM table WHERE MONTH(date)=3

 

... not sure that will work with the format you have though. You could use LIKE I suppose...

 

SELECT * FROM table WHERE date LIKE '%March%

 

... not tested it though, just an idea.

Link to comment
https://forums.phpfreaks.com/topic/179720-php-mysql-and-date/#findComment-948267
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.