Date and time issues
| From: | Frederik Feys | Date: | Tue, 05 Nov 2002 22:29:09 +0000 |
| Subject: | Date and time issues | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-23001@lists.php.net to get a copy of this message | ||
> Subject: Re: [PHP-DB] Date and time issues
>
> If you are using MySQL, you may profitably investigate the function
> DATE_ADD( date, INTERVAL )
>
> Ignatius J. Reilly
Thanks Ignatius! Fred.
This did it:
$interval="1 HOUR";
$subscr_text="1 sessie";
}
else if ($subscr_type==3) {
$interval="90 DAY";
$subscr_text="abonnement 3 maand";
}
else if ($subscr_type==12) {
$interval="1 YEAR";
$subscr_text="abonnement 12 maand";
}
$sql = "SELECT * FROM subscriptions WHERE ((DATE_ADD(act_date, INTERVAL
$interval) > CURDATE()) AND (us_id= \"$sel_us_id\"))";//validate subscritoin
date
$result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() .
": " . mysql_error());
$num = @mysql_num_rows($result);
if ($num!=0) //valid subscription all checks passed
{
> ____________________________________________
> ----- Original Message -----
> From: "Frederik Feys" <frederikfeys@pandora.be>
> To: <php-db@lists.php.net>
> Sent: Monday, November 04, 2002 10:32 PM
> Subject: [PHP-DB] Date and time issues
>
>
>> Hi all,
>> I searched for 5 hours, trying to solve my (newbie?) problem. I want to
> pick
>> today's date and add XXX days to it. Its setup to validate membership
>> period. Now my column is of date type. Aswell, I want to pick current time
>> and add 1 hour to it. Here aswell, sessions expire after one hour.
>> Can anybody help me?
>> Thanks
>
>