title: PHP:update a stock with values in the cart
body: <p>I am currently  working on an eCommerce website, but i need some advice regarding the stock management.</p>
  
  <p>I want the shopping cart to work as follow:</p>
  
  <ul>
  <li>CostumerA add a productO to cart with a quantity of '1'. </li>
  <li>CostumerB tries to add the same product to their cart but with no success.</li>
  <li>CostumerA logs out or their session expires.</li>
  <li>CostumerB tries to add productO again and is allowed to do so since the product hasn't been added to CustomerA's cart ...</li>
  </ul>
  
  <p>i came up with 2 solutions but neither is reliable from my point of view:</p>
  
  <ol>
  <li>add a field 'champ' to Table product that initially have value of product.quantity but change with cart movements.   </li>
  <li>add table Cart and update it with cart movements.</li>
  </ol>
  
  <p>as u can see both solution require lot of work.Is there a better way to implement my shopping cart.</p>