andre3 Posted November 21, 2008 Share Posted November 21, 2008 Hi guys. i am doing a referal thing, where members that refer 5 persons get 6 months free added to there expire date in the database, i have a field in the members table called: Expire it looks like: 2009-06-30, i know how to update the date so that they get a extra 6 months if their expire date is equal to 6 or less than, but when it reaches 7 months thats when i have a problem. because i wud ofto update the year and the month can any one make a suggestion ? please thanks Link to comment https://forums.phpfreaks.com/topic/133587-update-date-in-table/ Share on other sites More sharing options...
gevans Posted November 21, 2008 Share Posted November 21, 2008 add 6 to the month so for august 8 + 6 = 14 divide by the number of months and find remeinder 14 / 12 = 1 r2 if there's a 1 and a remeinder add 1 to the year and the remeinder as the month Link to comment https://forums.phpfreaks.com/topic/133587-update-date-in-table/#findComment-694872 Share on other sites More sharing options...
andre3 Posted November 21, 2008 Author Share Posted November 21, 2008 your saying that if the persons expire date is: 2009-08-30 and he/seh refered 5 persons and its time to update he/she expired date in the table with addtional 6 months, i must add 8 + 6 = 14 and then 14 / 12 = 1 1/2 right ? Link to comment https://forums.phpfreaks.com/topic/133587-update-date-in-table/#findComment-694903 Share on other sites More sharing options...
gevans Posted November 21, 2008 Share Posted November 21, 2008 the 14/12 = 1 with 2 left over (you can get this using % in php) that way if you get a remeinder you know you're in the next year This may not be the best solution, but the one that came to my head first Link to comment https://forums.phpfreaks.com/topic/133587-update-date-in-table/#findComment-694918 Share on other sites More sharing options...
andre3 Posted November 21, 2008 Author Share Posted November 21, 2008 oh cool, i finally got it to work my way.. thanks alot, i used mktime Link to comment https://forums.phpfreaks.com/topic/133587-update-date-in-table/#findComment-694988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.