hyster Posted November 29, 2010 Share Posted November 29, 2010 this code works fine if the conditions are absolute ( pass, fail or empty). im trying to make the fail work if its part of the query. ive tried %fail% but didnt work. $choice = strtoupper($rows['comments']); if($choice == "PASS"){ $bgc = "#ff25f0" ; } elseif($choice == "FAIL"){ $bgc = "#666666" ; }else{ $bgc = "#FF6600" ; } Link to comment https://forums.phpfreaks.com/topic/220109-if-statment-condition/ Share on other sites More sharing options...
requinix Posted November 29, 2010 Share Posted November 29, 2010 Try stripos. You can drop the strtoupper() if you use it. Link to comment https://forums.phpfreaks.com/topic/220109-if-statment-condition/#findComment-1140804 Share on other sites More sharing options...
hyster Posted November 29, 2010 Author Share Posted November 29, 2010 thanks requinix got it working with this $term = 'FAIL'; $comt = ($rows['comments']); $pos2 = stripos($comt, $term); if($choice == "PASS"){ $bgc = "#ff25f0" ; } elseif ($pos2 !== false){ $bgc = "#666666" ; }else{ $bgc = "#FF6600" ; } Link to comment https://forums.phpfreaks.com/topic/220109-if-statment-condition/#findComment-1140809 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.