Jump to content

Foreach loop, maybe I'm missing something?


Zurev

Recommended Posts

foreach ($export as $group => $arrayOpts) 
	{
		//echo $arrayOpts[0]["choice"]; This returns No
		/**
		  * If the option hasn't been selected, leave that part out entirely
		 **/		
		if (!empty($arrayOpts)) // if the entire options array isn't empty, we'll display
		{
		   if ($arrayOpts[0]["choice"]!="0" || $arrayOpts[0]["choice"]!="No")
		   {
				$pdf->Cell(40,10,$group,0,1); 
				$pdf->ImprovedTable($header,$arrayOpts);
				$pdf->Ln();
		   }
		}
	}

 

Unfortunately I can't show print_r's at the moment, the main issue is it's running those $pdf-> lines even if that variable is equal to No, I proved it because up above commented out returns No, but it still runs the pdf code.

 

Any thoughts? Been staring at it a while, maybe it's something in my conditional statement? Thanks.

Link to comment
Share on other sites

Presuming you don't want the value to be either zero or 'no':

if ($arrayOpts[0]["choice"]!="0" && $arrayOpts[0]["choice"]!="No")

 

I can't test it, but it seems that'll work. I honestly stared at those lines for a solid 1.5 hours today.  :'(

Link to comment
Share on other sites

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.