anser316 Posted March 24, 2008 Share Posted March 24, 2008 Hi i have a problem with selecting rows from MySQL onto PHP which have a date in the current month, previous month, previous year and current year (they will be on seperate forms) e.g. ID date 01 2008-03-24 03 2008-02-01 04 2007-03-04 PHP current month 01 previous month 02 etc i was thinking maybe to stick the date into a variable, and find that using php but i am not sure Quote Link to comment Share on other sites More sharing options...
s0c0 Posted March 24, 2008 Share Posted March 24, 2008 mktime wrapped inside of the date function with use of explode is you're friend for instance. $currentDate=date('Y-m-d'); // you probably want to store the date the user is viewing as a GET variable $dateArr=explode($currentDate,'-'); $nextDate=date('Y-m-d',mktime('12','0','0','0',$dateArr[2],$dateArr[1]-1,$dateArr[0])); The syntax in that is probably wrong, but you look up those functions and you should be able to figure the exact syntax out based on what I gave you. I'd do it, but my hash browns are almost done. Good luck. 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.