How to display the website number of product available for purchase?
Please tell me how best to implement the output dynamic values (the quantity of goods available for purchase) on the website.
There is a main page of the site, form for payment of the goods over which the quantity of goods available to purchase, after payment by the user, this value must be subtracted the quantity of goods purchased by the user.
Initially, the item quantity is set by the site owner and can be edited at any time.
As I understand it you need to create a database, and in it a table with one value equal to the original count of the goods. Then on the website using PHP to get this value, and after successful payment, deduct the value transferred to the payment system of values in database, by PHP.
Please correct if I misunderstood the algorithm and the principle which can be applied in my question. Perhaps there is a more correct implementation that I described above?