MySQL_Narb Posted February 11, 2013 Share Posted February 11, 2013 FULL source: http://paste2.org/p/2847150 foreach($results as $result){ //skill name $skill = $result->firstChild->nodeValue; $info = $result->getElementsByTagName('td'); //skill info $rank = $info->item(1)->nodeValue; $level = $info->item(2)->nodeValue; $xp = $info->item(3)->nodeValue; if($skill != 'Skill'){ echo '<b>'. $skill .'</b> <b>'. $xp .'</b> <hr>'; if($skill == 'Overall' && $xp == '-'){ $exists = false; break; } //SKILL:RANK:LEVEL:XP $skill_info[] = $skill .':'. $rank .':'. $level .':'. $xp; } } In the above code, why doesn't the following if statement work: if($skill == 'Overall' && $xp == '-'){ $exists = false; break; } As you can see, I echoed out the variables and both are what they should be. I even checked the page source to see if there were any special surprises, and there wasn't. Any ideas? PICTURE OF ECHOED RESULTS: http://puu.sh/20E4q Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 Do a var_dump on the variables. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2013 Share Posted February 11, 2013 And also state what you expect it to do to "work" Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted February 11, 2013 Author Share Posted February 11, 2013 Do a var_dump on the variables. Aha, thank you. Forgot about this. It turns out the string had extra whitespaces in it. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.