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
https://forums.phpfreaks.com/topic/156577-solved-help-with-ifelse-statement/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.