Joshua Posted November 12, 2009 Share Posted November 12, 2009 The way I want this to work is if a user matches ANY of the 3 race settings they can use it. If they Don't match, it denies them. I am not sure how to get this to work like that if($ir['race'] != $r['item_race'] OR $ir['race'] != $r['item_race2'] OR $ir['race'] != $r['item_race3']) { print "The selected item is not able to be used by your race."; $h->endpage(); exit; } Any help would be appreciated, i'm thinking using arrays, but not sure how i'd set that up properly. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted November 12, 2009 Share Posted November 12, 2009 if($ir['race'] != $r['item_race'] || $ir['race'] != $r['item_race2'] || $ir['race'] != $r['item_race3']) Try that, have you set what $r is? Quote Link to comment Share on other sites More sharing options...
Joshua Posted November 12, 2009 Author Share Posted November 12, 2009 Tried that, $r is set. I want an IF type function, i.e if their race matches ANY of the 3 they can use so if their race is 3. and item_race=2, item_race2=2, item_race3=3 THey can use but if it's not in those 3, they cant.....make sense? :P Quote Link to comment Share on other sites More sharing options...
Danny696 Posted November 12, 2009 Share Posted November 12, 2009 Pm me the code, ill do what i can Quote Link to comment Share on other sites More sharing options...
Joshua Posted November 12, 2009 Author Share Posted November 12, 2009 Pm sent, Should be a simple fix and i'm brain farting over here. that's why I was thinking i may have to set up some form of array Quote Link to comment Share on other sites More sharing options...
seanybob Posted November 12, 2009 Share Posted November 12, 2009 RE: Someone help me with using an ARRAY system here if($ir['race'] != $r['item_race'] && $ir['race'] != $r['item_race2'] AND $ir['race'] != $r['item_race3']) { //if you race isn't item_race, item_race2, and item_race3 then you shouldn't be here print "The selected item is not able to be used by your race."; $h->endpage(); exit; } Quote Link to comment Share on other sites More sharing options...
Joshua Posted November 12, 2009 Author Share Posted November 12, 2009 Problem i'm having Seany Is that it only has to match ONE of the 3. So if($ir['race'] != $r['item_race'] BUT It matches item_race2 or item_race 3. They can use the item If $IR race doesnt match ANY of the 3 they cant :P Quote Link to comment Share on other sites More sharing options...
seanybob Posted November 12, 2009 Share Posted November 12, 2009 Problem i'm having Seany Is that it only has to match ONE of the 3. So if($ir['race'] != $r['item_race'] BUT It matches item_race2 or item_race 3. They can use the item If $IR race doesnt match ANY of the 3 they cant :P That's what my code does... If it doesn't match any ONE of the three, it throws the error inside the if control statement. Quote Link to comment Share on other sites More sharing options...
Joshua Posted November 12, 2009 Author Share Posted November 12, 2009 Hm seems like i've tried that way because it's saying if the race doesnt match ALL 3. At least that's what I was reading >,< Perhaps I'm reading it wrong, i'll give it a go :p Quote Link to comment Share on other sites More sharing options...
Joshua Posted November 12, 2009 Author Share Posted November 12, 2009 And that did work and after going over it and reading it a bit better I see why. All 3 have to be != for that to work Gotcha >< I was thinking about it wrong, god sometimes i sware. =P Thanks man +1 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.