I am trying to add items to a shopping cart. I am using session id for the cart to select the items added and display them on the screen I do this by
$sql="SELECT * FROM order_line WHERE order_ID='$tran_ID'";
but to add items from the shop to the cart I use
$sql="INSERT INTO order_line (item, price) SELECT shop.item, shop.price FROM shop WHERE shop.item='widget'";
however I need to include the $tran_ID into order_line but at this time the order_ID is NULL I can add
$sql="insert into order_line (order_id) values ($tran_ID)";
but that makes the item field NULL
so from shop I need to add item, price, order_ID into order_line. So it selects the items from the session id which is pulled from order_ID. how would i do this? as at the moment u get to the cart and its not selecting the session id because it is null in the cart.
Damn this is confusing.
Please help if u can understand the question, if not please ask me to elaborate on the items you don’t understand.
Thank u