Jump to content

[SOLVED] Help with if/else statement


sailorsmokey

Recommended Posts

Hi everyone!

 

I know my logic must be faulty somewhere here, because this if/else statement isn't returning the correct result.  Could someone either correct me or at least give me enough direction to find my own mistake?  I'm trying to take the current date, and check to see if it within the range of the date it becomes valid, and the expiration date.  I thought this would be simple, and it probably is, but I'm missing something.

 

Here's what I've got:

 

$today=getdate();
if($today<$valid_date or $today>$exp_date)
{
echo "<p>Coupon has expired - discount not included in total.<br />";
}

Link to comment
Share on other sites

Now I feel a little ridiculous.  I used to be pretty handy with this PHP stuff, and I haven't touched it for a while, so I'm obviously quite a bit rusty.

 

$valid_date is a value from MySQL table, stored as YYYY-MM-DD, and in this case it is 2009-05-01.

 

$exp_date is the same, and in this case it is 2009-12-31.

 

Any other comments that could help me out would be appreciated - meanwhile, I'll start reading up on date() and var_dump() a bit.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.