gurpreet Posted December 17, 2008 Share Posted December 17, 2008 I was going through my crappy coding, obviously done by me and i saw this: if($ir['fedjail'] > 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } I was just wondering, seeing as that doesnt work, how do you do if it does NOT equal 0? Example: if($ir['fedjail'] (stuff for does not)= 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } so it's saying if fedjail does NOT equal 0, you can't attack them, if it is 0, you can. Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted December 17, 2008 Share Posted December 17, 2008 Re: Quick coding question Use != eg. if($ir['fedjail'] != 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } Quote Link to comment Share on other sites More sharing options...
gurpreet Posted December 17, 2008 Author Share Posted December 17, 2008 Re: Quick coding question Use != eg. if($ir['fedjail'] != 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } Hmm can still attack people in fed. Does the != mean the negative of the normal stuff? Quote Link to comment Share on other sites More sharing options...
Joel Posted December 17, 2008 Share Posted December 17, 2008 Re: Quick coding question Use != eg. if($ir['fedjail'] != 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } Hmm can still attack people in fed. Does the != mean the negative of the normal stuff? http://www.w3schools.com/php/php_operators.asp Have a look at the operators. Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted December 17, 2008 Share Posted December 17, 2008 Re: Quick coding question this is the same problem..your using $ir that mean you...your wanting to check the other person and in the attack.php thats $odata So use this. if($odata['fedjail'] != 0) { print "No attacking people who can't attack back...TUT TUT!"; $h->endpage(); exit; } Quote Link to comment Share on other sites More sharing options...
shaved92bravada Posted December 17, 2008 Share Posted December 17, 2008 Re: Quick coding question beat me to it alabama .... lol Quote Link to comment Share on other sites More sharing options...
POG1 Posted December 17, 2008 Share Posted December 17, 2008 Re: Quick coding question what about? if(!empty($odata['fedjail)) { Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted December 18, 2008 Share Posted December 18, 2008 Re: Quick coding question oh dear Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted December 18, 2008 Share Posted December 18, 2008 Re: Quick coding question wouldn't if(!empty($odata['fedjail)) be not empty which basically means it contains something besides null ... Quote Link to comment Share on other sites More sharing options...
POG1 Posted December 18, 2008 Share Posted December 18, 2008 Re: Quick coding question the default value would be null though... 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.