Change it to == 1
if("$current_month == 1")
Jason
-----Original Message-----
From: Jacob Walker [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 10:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] problem with working with dates
I'm sorry to bother the newsgroup with this, but I've been racking my
brain on it for a few hours, and tried all the documentation, and
realize it's a coding problem that will take someone about 3 seconds to
figure out the error in. I have this code:
<?php
$current_month = date (m);
$current_year = date (Y);
if("$current_month = 1")
{
$previous_month = 12;
$previous_year = $current_year - 1;
}
else
{
$previous_month = $current_month - 1;
$previous_year = $current_year;
}
print("<ul>");
print("<li><a
href=\"inquiry_reports.php?search=search&new_year=$previous_year&new_month=$
previous_month\">Previous
Month</a>");
print("<li><a
href=\"inquiry_reports.php?search=search&new_year=$current_year&new_month=$c
urrent_month\">Current
Month</a>");
print("</ul>");
?>
but for some reason, no matter what the month, the first if statement
(if current_month = 1) is seen as true and executes... any suggestions?
Cheers
Jake Walker
[EMAIL PROTECTED]
--
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