gurpreet Posted June 24, 2009 Posted June 24, 2009 Ok so I want it to display 5 images: jail.gif - When nobody is in jail (green jail pic) jail2.gif - When 1 or more are in jail (Red jail pic) hospital.gif - When nobody in hosp (green hosp pic) hospital2.gif - When 1 or more in hosp (yellow hosp pic) hospital3.gif - When 5 or more in hosp (red hosp pic) if($jc > 0) { print "[url='jail.php'][img=*****/jail2.gif][/url]"; } else { print "[url='jail.php'][img=*****/jail.gif][/url]"; } if($hc > 10) { print "[url='hospital.php'][img=*****/hospital3.gif][/url]"; } else if($hc == 0) { print "[url='hospital.php'][img=*****/hospital2.gif][/url]"; } else { print "[url='hospital.php'][img=*****/hospital.gif][/url]"; } When I use that, it only shows the green pic, even when 16 people are in hospital. Any help will be appreciated Quote
AlabamaHit Posted June 24, 2009 Posted June 24, 2009 Re: Jail and Hospital if($jc == 0) { echo 'green jail pic'; } else { echo 'red jail pic'; } // //Now for hospital // if($hc == 0) { echo 'green hos pic'; } else if($hc > 0 && $hc < 5) { echo 'yellow hosp pic'; } else { echo 'red hosp pic'; } Quote
Lithium Posted June 24, 2009 Posted June 24, 2009 Re: Jail and Hospital echo $jc = ($jc) ? 'green pic' : 'red pic'; echo $hc = (!$hc) ? 'green pic' : ($hc > '0' && $hc < '5') ? 'yellow pic' : 'red pic'; Quote
gurpreet Posted June 24, 2009 Author Posted June 24, 2009 Re: Jail and Hospital Tried both, got unexpected T_String. Here's Lithium's one, uncensored >.< Just spaced out so it's easier for me (I'm too tired atm) echo $jc = ($jc) ? '[url='jail.php'][img=ikony/jail.gif][/url]' : '[url='jail.php'][img=ikony/jail2.gif][/url]'; echo $hc = (!$hc) ? '[url='hospital.php'][img=ikony/hospital.gif][/url]' : ($hc > '0' && $hc < '5') ? '[url='hospital.php'][img=ikony/hospital2.gif][/url]' : '[url='hospital.php'][img=ikony/hospital3.gif][/url]'; Please correct that if it's wrong. Quote
Lithium Posted June 24, 2009 Posted June 24, 2009 Re: Jail and Hospital echo $jc = ($jc) ? '[url="jail.php"][img=ikony/jail.gif][/url]' : '[url="jail.php"][img=ikony/jail2.gif][/url]'; and echo $hc = (!$hc) ? '[url="hospital.php"][img=ikony/hospital.gif][/url]' : ($hc > '0' && $hc < '5') ? '[url="hospital.php"][img=ikony/hospital2.gif][/url]' : '[url="hospital.php"][img=ikony/hospital3.gif][/url]'; Quote
Lithium Posted June 24, 2009 Posted June 24, 2009 Re: Jail and Hospital @ gurpreet... see the difference between my last and yours? that was the reason you got the error ;) oh... replace the code of your OP for this one if($jc > 0) { print "[url='jail.php'][img=*****/jail2.gif][/url]"; } else { print "[url='jail.php'][img=*****/jail.gif][/url]"; } if($hc > 10) { print "[url='hospital.php'][img=*****/hospital3.gif][/url]"; } else if($hc == 0) { print "[url='hospital.php'][img=*****/hospital2.gif][/url]"; } else { print "[url='hospital.php'][img=*****/hospital.gif][/url]"; } trash this bit away and place the one i posted last Quote
gurpreet Posted June 24, 2009 Author Posted June 24, 2009 Re: Jail and Hospital echo $jc = ($jc) ? '[url="jail.php"][img=ikony/jail.gif][/url]' : '[url="jail.php"][img=ikony/jail2.gif][/url]'; and echo $hc = (!$hc) ? '[url="hospital.php"][img=ikony/hospital.gif][/url]' : ($hc > '0' && $hc < '5') ? '[url="hospital.php"][img=ikony/hospital2.gif][/url]' : '[url="hospital.php"][img=ikony/hospital3.gif][/url]'; Yeh, I think something is up with my files, because this shows the yellow of each (No people in jail or hosp, so it should be green) Quote
Lithium Posted June 24, 2009 Posted June 24, 2009 Re: Jail and Hospital do a print_r($jc); and print_r($hc); just to see what each one returns when you call them. you can place those right near the displays so you can know what is what Quote
gurpreet Posted June 25, 2009 Author Posted June 25, 2009 Re: Jail and Hospital do a print_r($jc); and print_r($hc); just to see what each one returns when you call them. you can place those right near the displays so you can know what is what They both produce the yellow pic. 2 were in hospital, 0 in jail. Quote
Haunted Dawg Posted June 25, 2009 Posted June 25, 2009 Re: Jail and Hospital //Jail echo ((!$jc) ? '[url="jail.php"][img=ikony/jail.gif][/url]' : '[url="jail.php"][img=ikony/jail2.gif][/url]'); //Hospital echo ((!$hc) ? '[url="hospital.php"][img=ikony/hospital.gif][/url]' : (($hc >= 5) ? '[url="hospital.php"][img=ikony/hospital3.gif][/url]' : '[url="hospital.php"][img=ikony/hospital2.gif][/url]')); Try that.. Quote
gurpreet Posted June 25, 2009 Author Posted June 25, 2009 Re: Jail and Hospital //Jail echo ((!$jc) ? '[url="jail.php"][img=ikony/jail.gif][/url]' : '[url="jail.php"][img=ikony/jail2.gif][/url]'); //Hospital echo ((!$hc) ? '[url="hospital.php"][img=ikony/hospital.gif][/url]' : (($hc >= 5) ? '[url="hospital.php"][img=ikony/hospital3.gif][/url]' : '[url="hospital.php"][img=ikony/hospital2.gif][/url]')); Try that.. That doesn't seem to work...I may give up on this idea, it's not a priority. Thanks for your help everyone 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.