HITMAN 17 Posted February 16, 2009 Posted February 16, 2009 if($ir['jail'] > 1) { $back = "#FF0000"; } else if($ir['hospital'] > 1) { $back = "#FF0000";} else { $back = "#CCCCCC"; } this is not working can someone help me fix please Quote
Lithium Posted February 16, 2009 Posted February 16, 2009 Re: Hosp And Jail Change Background error $back = (($ir['jail']) || ($ir['hospital'])) ? "#FF0000" : "#CCCCCC"; though yours should work too unless you are using .css Quote
Karlos Posted February 16, 2009 Posted February 16, 2009 Re: Hosp And Jail Change Background error $back = (($ir['jail'] > '1') || ($ir['hospital'] > '1')) ? "#FF0000" : "#CCCCCC"; Quote
Lithium Posted February 16, 2009 Posted February 16, 2009 Re: Hosp And Jail Change Background error $back = (($ir['jail'] > '1') || ($ir['hospital'] > '1')) ? "#FF0000" : "#CCCCCC"; you don't need the > 1 here ;) it returns true if the value is > 0 ;) Quote
Karlos Posted February 16, 2009 Posted February 16, 2009 Re: Hosp And Jail Change Background error For one, i personally always prefer to do > '1' :wink: Quote
HITMAN 17 Posted March 16, 2009 Author Posted March 16, 2009 Re: Hosp And Jail Change Background error $back = (($ir['jail'])) ? "#FF9900" : "#CCCCCC"; $back = (($ir['hospital'])) ? "#FFFFFF" : "#CCCCCC"; this should work but dont Quote
AlabamaHit Posted March 16, 2009 Posted March 16, 2009 Re: Hosp And Jail Change Background error $back = (($ir['jail'] > '1') || ($ir['hospital'] > '1')) ? "#FF0000" : "#CCCCCC"; you don't need the > 1 here ;) it returns true if the value is > 0 ;) Ok....what if the time is 1 Then your wont work. if you like to use it then Use > 0 not > 1 Quote
Magictallguy Posted March 16, 2009 Posted March 16, 2009 Re: Hosp And Jail Change Background error All code suggestions posted work fine. Make sure you are echoing the output for the users echo sprintf("<td style='background-color: %s;'>", $back); Quote
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.