jeeva Posted April 12, 2007 Share Posted April 12, 2007 hi frnds, i have done one form where the data will be listed from the database.Now the user asking me to change the data sholud be list by current month. But i was storing the data like 12-4-2007 here can i list by month? but i know we can do by changing the database but i dont want to change the database its very difficult to change the user database. Any one can help me? Link to comment https://forums.phpfreaks.com/topic/46677-list-the-data-by-month/ Share on other sites More sharing options...
rcorlew Posted April 12, 2007 Share Posted April 12, 2007 You should try this if your month is the second number in your in your date format: <?php $date = date("j-n-Y") $sql = "Select * FROM table WHERE formdate LIKE '%$date%'" ?> Link to comment https://forums.phpfreaks.com/topic/46677-list-the-data-by-month/#findComment-227411 Share on other sites More sharing options...
jeeva Posted April 12, 2007 Author Share Posted April 12, 2007 No it does not seems work Link to comment https://forums.phpfreaks.com/topic/46677-list-the-data-by-month/#findComment-227414 Share on other sites More sharing options...
prabhuksmani Posted April 12, 2007 Share Posted April 12, 2007 Hi, Use this SQL Query.... SELECT * FROM table WHERE MONTH( `formdate` ) = MONTH( CURDATE( ) ) ; Thanks Prabhu Link to comment https://forums.phpfreaks.com/topic/46677-list-the-data-by-month/#findComment-227507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.