question about a part of my script

Discussion in 'PHP' started by user099, Dec 18, 2009.

  1. #1
    hi,
    this is a part of the code:
    if(($sapphire3 < 0 || (is_numeric($sapphire3) != true)) || ($sapphire4 < 0 || (is_numeric($sapphire4) != true)) || ($ruby < 0 || (is_numeric($ruby) != true)) || ($ruby2 < 0 || (is_numeric($ruby2) != true)) || ($ruby3 < 0 || (is_numeric($ruby3) != true)) || ($ruby4 < 0 || (is_numeric($ruby4) != true)) || ($onyx < 0 || (is_numeric($onyx) != true))){
    echo "<br><center><font color=red><b>Error:</b></font> All numeric fields must be positive numbers and can't be blank.<br>";
    Code (markup):
    the problem is, when the value is 0 it shows always the echo text. is there a mistake in the code?

    i hope you could understand me.
     
    user099, Dec 18, 2009 IP
  2. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    because 0 doesn't have a value..
    you cannot say $value<0
    if you meant the value will be -1, -2 then I think you need to make it like that:

    rep me up if that helps :)
     
    xenon2010, Dec 18, 2009 IP