shopping cart - the workings dont make sence
I am in the process of creating a shopping cart. Before i wanted to create this cart i am trying to work out how exactly i will sucessfully make an order. My tables in the database are CUSTOMER-ORDER-ORDERLINE-PRODUCT
Now i have a cart setup where i can add items to a cart and that works fine, it uses another table to save cookies. The problem is that im not sure how to transfer the cart information to the tables as, when there is a confirmation that the order is correct and the customers details are correct, an order number must be created. how would i then retreave this number (which will be auto_increment) then use it in the orderline.
So i will have something like "insert into customer" and add details into the customer table, then maybe use "select cust_id where name = $name" to get the cust_id which will be auto_increment. Now i have the cust_id i will have to add to order. Then i would have to retreve order_id (somehow) and add to orderline.
What i dont understand is how can i do all of this in one step/script. There must be an easier way of doing this process but im not sure about the auto_increment and retreaving these.
if what i have said doesnt make sence then let me know and i will try to explain it again.
You probably need something like this:
$cust_id = mysql_insert_id();
could you possibly give me an example situation of the code you mentioned.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)