Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.