Re: detecting negative numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave W wrote:
> Currently I have this:
> 
> if($quant > $amount) {echo "You don't have that many!"; }
> 
> $quant is the user inputted amount and $amount is the amount that they
> actually have. Is there any way of checking if the result is negative
> rather
> than doing what I have above?

Not sure which way around you want it, but I think this is what you are
after...

if (($quant - $amount) < 0)
{
    echo "You don't have that many!";
}

I don't mean any offense, but the possibility that someone who couldn't
figure that out is writing PHP code scares me. You might want to think
about Googling for an absolute beginners guide to programming before
continuing.

- -Stut
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEusYz2WdB7L+YMm4RAqGPAJ0QqkgfApO6h0GR9lXa47WyAhSsugCfaymW
Ba+bqZRbrcv6CuZ6g7FJJjw=
=ktnc
-----END PGP SIGNATURE-----

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux