RE: [PHP] problem with working with dates

From: Date: Fri, 15 Feb 2002 17:57:58 +0000
Subject: RE: [PHP] problem with working with dates
Groups: php.general 
Request: Send a blank email to php-general+get-84950@lists.php.net to get a copy of this message
Change it to == 1 if("$current_month == 1") Jason -----Original Message----- From: Jacob Walker [mailto:jake@jakewalker.com] Sent: Friday, February 15, 2002 10:44 AM To: php-general@lists.php.net 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 jake@jakewalker.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#84950) next »