hchsk Posted May 13, 2009 Share Posted May 13, 2009 the foreach loop below is adding to $warningfeed excessively. i have checked, the loop runs the correct number of times, 11. $info is an array of eleven date/times, which need to each be checked if the current date/time is x amount of time away from three days past the element date/time. if so, it should add an item to $warningfeed. Srtto2Time($inactive) correctly creates it's array. $nowpub is the current date/time. $bits is an array of inactivity status' between zero and three, which must be reset if the team is no longer inactive. $warningfeed = ''; foreach($info as $key => $value) { $inactive = (strtotime($value)+259200) - strtotime($nowpub); $inactive = Srtto2Time($inactive); $hold = $key+1; $warning = ''; if (($value == 3) && (intval($inactive[seconds]) > 0)) {$value = 0;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 12)) {$warning = 'Team ' . $hold . ' is in danger of inactivity. Less than twelve hours left!'; $bits[$key-1] += 1;} if ((intval($inactive[days]) == 0) && (intval($inactive[hours]) < 1)) {$warning = 'Team ' . $hold . ' is in danger of inactivity. Less than one hour left!'; $bits[$key-1] += 1;} if (intval($inactive[seconds]) < 0) {$warning = 'Team ' . $hold . ' has been declared inactive. Please contact a judge for shootout details.'; $bits[$key-1] += 1;} ///////////////////////////////////////////////////////////////////////////////CHANGE TO TEAM NAMES HERE //CREATE ITEM $warning if ($warning != '') { $warningfeed .= $warningfeed . " <item> <title> Network Update</title> <category>$category</category> <link>http://website/circle.php</link> <description>$warning</description> <pubDate>$nowpub</pubDate> </item>"; } } any help, ideas, suggestions, would mean a lot. thanks for your time. Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/ Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted May 13, 2009 Share Posted May 13, 2009 $warningfeed .= $warningfeed . " You see nothing wrong with this ? Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833634 Share on other sites More sharing options...
Andy-H Posted May 13, 2009 Share Posted May 13, 2009 $warningfeed .= $warningfeed . " <item> <title> Network Update</title> <category>$category</category> <link>http://website/circle.php</link> <description>$warning</description> <pubDate>$nowpub</pubDate> </item>"; I dont?? Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833640 Share on other sites More sharing options...
Andy-H Posted May 13, 2009 Share Posted May 13, 2009 Can you print_r the $inactive array and show the results? Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833646 Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted May 13, 2009 Share Posted May 13, 2009 Re-read it. Twice or more if it don't work. ...is adding to $warningfeed excessively... $warningfeed .= $warningfeed . " Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833664 Share on other sites More sharing options...
Andy-H Posted May 14, 2009 Share Posted May 14, 2009 Ahh, got you lmao. $warningfeed .= " Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833675 Share on other sites More sharing options...
hchsk Posted May 14, 2009 Author Share Posted May 14, 2009 careless. thank you. Link to comment https://forums.phpfreaks.com/topic/158027-solved-foreach-problem/#findComment-833722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.