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? Quote Link to comment 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%'" ?> Quote Link to comment Share on other sites More sharing options...
jeeva Posted April 12, 2007 Author Share Posted April 12, 2007 No it does not seems work Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.