Here's a piece of code from a script I wrote for our jewelry store that looks to
see if the promotional discount code is still valid...   I don't see any reason
why Felix's method wouldn't work either; it's doing pretty much the same thing
as mine...

  $mysql_query=qq{SELECT CURRENT_DATE-DATE_FORMAT(VALID_TO,'%Y%m%d') from
discount_codes where discount_code='$DISCOUNT_CODE'};
        $sth = $dbh->prepare ("$mysql_query");
        $sth->execute();
        $EXPIRED=$sth->fetchrow_array();
        $sth->finish();

        if ($EXPIRED <= 0) {$EXPIRED="N";}
        if ($EXPIRED > 0)  {$EXPIRED="Y";}



Soheil Shaghaghi wrote:

> Hi everyone,
> I am trying to do some calculations based on the date the users have
> registered with the site.
>
> I want to sell a service.
> I have a form where the user comes to purchase the service.
> I can get the date from SQL database in any format and display it in form.
>
> At this point, when the user fills out the form and submits it, I want to
> look at the date.
> If the date is before August of 2002, the price should be set to $25.00, and
> if it's after August of 2002, it will be $50.00
>
> Can anyone tell me how I can do this please?
>
> Note: The form does not use SQL itself. It's just CGI.
>
> Thanks
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to