Zurev Posted January 13, 2011 Share Posted January 13, 2011 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 https://forums.phpfreaks.com/topic/224367-foreach-loop-maybe-im-missing-something/ Share on other sites More sharing options...
Pikachu2000 Posted January 13, 2011 Share Posted January 13, 2011 Presuming you don't want the value to be either zero or 'no': if ($arrayOpts[0]["choice"]!="0" && $arrayOpts[0]["choice"]!="No") Link to comment https://forums.phpfreaks.com/topic/224367-foreach-loop-maybe-im-missing-something/#findComment-1159115 Share on other sites More sharing options...
Zurev Posted January 13, 2011 Author Share Posted January 13, 2011 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 https://forums.phpfreaks.com/topic/224367-foreach-loop-maybe-im-missing-something/#findComment-1159125 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.