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()... 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? 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. 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? 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. 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 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. 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? 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()) 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)... 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. Link to comment https://forums.phpfreaks.com/topic/173957-current-month/#findComment-917515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.