techker Posted September 11, 2009 Share Posted September 11, 2009 hey guys i have a promo table with a filed that inserts the month (list box select).. i need to do a query to select the current month from the month table? i have tryed month() now()... Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/ Share on other sites More sharing options...
Maq Posted September 11, 2009 Share Posted September 11, 2009 Are you trying to extract the month or insert it? Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-916970 Share on other sites More sharing options...
techker Posted September 11, 2009 Author Share Posted September 11, 2009 extract the promotion of the month in the month field the client inserts the month. Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-916971 Share on other sites More sharing options...
fenway Posted September 12, 2009 Share Posted September 12, 2009 How is this stored in the db? Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917355 Share on other sites More sharing options...
Maq Posted September 12, 2009 Share Posted September 12, 2009 extract the promotion of the month in the month field the client inserts the month. If the client inserts the month, then it seems you should already have it. Maybe I'm confused. Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917364 Share on other sites More sharing options...
techker Posted September 12, 2009 Author Share Posted September 12, 2009 it does ya but i need to extract the promotions for every month.that is why i need it to select the promos from current month Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917386 Share on other sites More sharing options...
fenway Posted September 12, 2009 Share Posted September 12, 2009 Show us the queries you've tried and what they produce in error. Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917391 Share on other sites More sharing options...
techker Posted September 12, 2009 Author Share Posted September 12, 2009 well i tryed alot..lolforget but i figured that i can use the month() SELECT MONTH('2009-09-00'); cause they say with 00 -00 it shows the default..doesnt work so i tryed select all from promotions were month =NOW() no success is there a current month() ? in my fled the months are as is:JANUARY,FEB... but i have a date filed to that maybe i can use.it iserts the date of the creation of the promotion? Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917400 Share on other sites More sharing options...
techker Posted September 12, 2009 Author Share Posted September 12, 2009 found this to.. SELECT * FROM table WHERE YEAR(date) = YEAR(CURDATE()) AND MONTH(date) = MONTH(CURDATE()) Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917406 Share on other sites More sharing options...
techker Posted September 12, 2009 Author Share Posted September 12, 2009 ok so i got it going. created a variable :$curr_month = date("m"); then select * from pormotions were month = $curr_month ; i need to change the way the months were iserted. now they insert 01(jan) 02(feb)... Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917407 Share on other sites More sharing options...
fenway Posted September 13, 2009 Share Posted September 13, 2009 Again, when you don't store dates properly, date operations become painful. Quote Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917515 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.