Anders,

Are you missing a '|' in the if condition?


Michael Egan

-----Original Message-----
From: anders thoresson [mailto:[EMAIL PROTECTED]
Sent: 26 June 2003 12:01
To: [EMAIL PROTECTED]
Subject: [PHP] need help breaking out of loop.[Scanned]


Hi,

 I'm working of a PHP-MySQL-planning system for a newspaper. I want to add 
dates and number for each issue. I have to following code, where 
$current_date is a unix timestamp.

 If $current_date is a Saturday or Sunday, I want to quit the current 
execution of the loop and contiune with the next date. But when the if- 
clause that checks if $issue_day_of_week is Sunday or Saturday is included 
in my while-loop, everything stalls. Without it, everything goes smooth.

 What am I missing?

while ($i <= $number_of_days)
        {
                $issue_date = strftime("%Y-%m-%d", $current_date);
                $issue_month = date("m", $current_date);
                $issue_day = date("d", $current_date);
                $issue_day_of_week = date("l", $current_date);
        
                // Check that $issue_date isn't Saturday or Sunday
        
                if ($issue_day_of_week == "Sunday" | $issue_day_of_week == "Saturday")
                {
                        continue;
                }
        
                if ($issue_month == 1 & $issue_day == 1)
                {
                        $issue_number = 1;
                        $current_date = $current_date + 86400;
                        $i++;
                        $issue_number++;
                        continue;
                }
                $current_date = $current_date + 86400;          
                $i++;
                $issue_number++;
        }

-- 
anders thoresson

-- 
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

Reply via email to