Possible Duplicate:
Best way to prevent a value from going negative in mysql
Guys I am new to here and also to the programming. I am working on an inventory control system. I'll explain my problem using an example. Think my current stock is 500 sales should be reduced from the stock. When I am entering sales amount if I enter 1000 value would be -500. How can i avoid this?? currently I am doing it like this
--php pseudo code---
if(stock > sales)
{ stock - sales}
else
{error}
my data type is float(10,2).
Can I avoid this problem in any other way? I don't know whether my question is clear or not. (Sorry for my bad language skills)