Your working with strings right? Would your if command be:
if ($start_dts gt $end_dts) {
echo "This function thinks the end date is older than the start date.";
}
else {
echo "Whoah, it actually worked.";
}
In string you should use the gt comparitive instead of the >.
See if this works for you,
Josh Thomas
RPS Internet Services
-----Original Message-----
From: jc [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 11, 2002 4:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mkdate error?
The following bit of code completely baffles me as to why it doesn't work.
I am doing a very simple validation where I check to see if the "end date"
field of an inputted record is an older date than the "start date".
I checked this by putting in the same date for both end and start dates. Yet
mkdate gives me a different value for each even though since they are both
the same date, I should get the same value returned. Right?
//notice the start and end date is the same. Therefore, you should get the
same value for each, right?
<START LITTLE CODE SNIPPET>
$parsed_start_date=split("/", "08/02/2002");
$parsed_end_date=split("/", "08/02/2002");
$start_dts = mktime("", "", "", $parsed_start_date[0],
$parsed_start_date[1], $parsed_start_date[2]);
$end_dts = mktime("", "", "", $parsed_end_date[0], $parsed_end_date[1],
$parsed_date[2]);
if ($start_dts > $end_dts) {
echo "This function thinks the end date is older than the start date.";
}
else {
echo "Whoah, it actually worked.";
}
<END LITTLE CODE SNIPPET>
What am I not seeing?
Thanks in advance,
J. Chyun
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php