[PHP] problem while loop.
I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) = strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) = strtotime($end_date)) echo GO!!\n; else echo STOP!!!\n; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem while loop.
Jeff, The problem is most likely with incrementing $event_data. It's hard to say without seeing the rest of the code. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) = strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) = strtotime($end_date)) echo GO!!\n; else echo STOP!!!\n; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- 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
Re: [PHP] problem while loop.
It's all returning proper dates and the proper timestamps when I check them inside the loop. I'm formatting the dates in -MM-DD format and strtotime is returning the proper timestamps. I'm curious how can you say it's a problem with the dates when the if statement comparing the same expression as the while loop works properly? On Sun, 2002-02-24 at 13:09, Steven Walker wrote: Jeff, The problem is most likely with incrementing $event_data. It's hard to say without seeing the rest of the code. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) = strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) = strtotime($end_date)) echo GO!!\n; else echo STOP!!!\n; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem while loop.
Jeff, Everything you are doing sounds fine, and I don't see any logic problems with the while loop. However, I really can't extrapolate any further conclusion without more info. How are you determining that the if statement is working? As long as this loop is running it should always echo 'GO!!'. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Sunday, February 24, 2002, at 03:00 PM, Jeff Bearer wrote: It's all returning proper dates and the proper timestamps when I check them inside the loop. I'm formatting the dates in -MM-DD format and strtotime is returning the proper timestamps. I'm curious how can you say it's a problem with the dates when the if statement comparing the same expression as the while loop works properly? On Sun, 2002-02-24 at 13:09, Steven Walker wrote: Jeff, The problem is most likely with incrementing $event_data. It's hard to say without seeing the rest of the code. I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) = strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) = strtotime($end_date)) echo GO!!\n; else echo STOP!!!\n; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- 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
Re: [PHP] problem while loop.
Well, I found the problem. it wasn't happening where I thought it was. which brings up another question I'll have to ask in a new subject about output buffering. On Sun, 2002-02-24 at 18:00, Jeff Bearer wrote: It's all returning proper dates and the proper timestamps when I check them inside the loop. I'm formatting the dates in -MM-DD format and strtotime is returning the proper timestamps. I'm curious how can you say it's a problem with the dates when the if statement comparing the same expression as the while loop works properly? On Sun, 2002-02-24 at 13:09, Steven Walker wrote: Jeff, The problem is most likely with incrementing $event_data. It's hard to say without seeing the rest of the code. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) = strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) = strtotime($end_date)) echo GO!!\n; else echo STOP!!!\n; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php