laanes Posted March 16, 2011 Share Posted March 16, 2011 Hello, I am trying to build a query that looks into the number of products that are currently in stock, and if that is lower than the quantity entered in the cart then notify me that someone bought more items than in stock. What kind of fields should i link to connect products and orders table? There are: product_id, product_code and order_id in the orders table. product_id, product_code and stock_level in the products table. With thanks, laanes Quote Link to comment https://forums.phpfreaks.com/topic/230810-if-stock_level-the-entered-quantity/ Share on other sites More sharing options...
Maq Posted March 16, 2011 Share Posted March 16, 2011 You need to JOIN the tables by product_id and have a condition that specifies which order_id it is from the orders_table. Quote Link to comment https://forums.phpfreaks.com/topic/230810-if-stock_level-the-entered-quantity/#findComment-1188222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.