problem with working with dates
| From: | Jacob Walker | Date: | Fri, 15 Feb 2002 17:44:09 +0000 |
| Subject: | problem with working with dates | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84942@lists.php.net to get a copy of this message | ||
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=$current_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
jake@jakewalker.com