Got a question, I just noticed your signature, 'earn up to $10 per order
selling our PHP Scripts'. Are you paying us to help you out? =) Just
messing with ya.
Anyway, you'd probably want to use a 'DATE' field.
For checking the passing of a month, the easiest way would be to use the
getdate() function. You can check the numerical value of the month and day
to see if a month has passed. The only thing you might want to be careful
is if someone signs up on the 29-31, because February only has 28 days so
the days (29-31) would never match up. And of course the same goes for
months with 30 days and people who sign up on the 31st.
Unfortunately, I do not know of a way to do 'math' with dates to get the 30
day difference. I'm sure that with a little effort, you could write
something that will do it.
----EXAMPLE---
$today = getdate();
$month = $today['month'];
$mday = $today['mday'];
///get date from database
if ((($month - $dbmonth) == 1) && ($mday == $dbday)) {
///time to renew
///also take into account the transition from December to January, so
$month-$dbmonth == -12
}
-----END-----
Best regards,
Jeremy Reed
"Phpgalaxy.Com" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi! =)
>
> I'm doing a website that will be using a pay-per-month membership
> program. There's a field for 'lastpaid' that holds the date the last
> paid (sorry to state the obvious). My questions are these:
> 1) What would be the best way to format it so PHP can see if it's been
> 30 days since it was last paid?
> 2) What line of code would be used to check?
> 3) Would I set the field type to DATE, DATETIME, TIMESTAMP or soemthing
> else?
>
> Any help you can give would be much appreciated! I woulda taken the time
> to study it more in-depth but I'm trying to get as much done on this in
> 5 hours as I can. =)
>
> ~ Tim
>
> --
> From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts
> and Software on your Site. http://www.phpgalaxy.com/aff/
>
> Also, get a fast free POP3 email account, you @php.la at
> http://www.phpgalaxy.com/search/
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]