[eluser]megabyte[/eluser]
Ben,
What I am talking about is an inventory transaction table.
so yes you would have positive and negative values.
positive values would be purchases
negative values would be when you remove it.
I also have to use FIFO which is another problem, and I have a solution hopefully that works.
As for making sure I store correct nagative values, I am now using this regex in the form validation:
Code:
preg_match("/^(\d|-)?(\d|,)*\.?\d*$/", $str);
this makes sure it is only a negative or positive number with a single decimal point