Home  |  Linux  | Mysql  | PHP  | XML
From:Lee Collings Date:Tue Jun 17 18:18:24 2003
Subject:compound conditional statement driving me nuts
I'm wondering if anyone can solve this riddle for me.

I am trying to compare a couple of dates using the following

if 	(($start_pub_year ge $yr && $end_pub_year le $yr) &&
	 ($start_pub_mon ge $mo && $end_pub_mon le $mo) &&
	 ($start_pub_day ge $day && $end_pub_day le $day))
	{
Print "it is a valid date"
	}
Print "it isn't a valid date"

but nothing I try works.  I've used, &, &&, and all to no avail.

Where is what I'm trying to do "in english"

If todays year is greater than the  beginning publish year and less 
than the ending publish year
  and
If todays month is greater than the  beginning publish month and less 
than the ending publish month
  and
If todays day is greater than the  beginning publish day and less than 
the ending publish day

Show me the valid date message
else
Show me the invalid message

You can see an example of this failing at: 
http://www.foothill.edu/cgi/newscenter.cal.cgi

If I just test for the year, it works. But when I try to add the tests 
for they month and day, it fails.

Any takers?

TIA,

Lee Collings

Navigate in group perl.macperl.webcgi at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants