www.webdeveloper.com
Results 1 to 3 of 3

Thread: shopping cart - the workings dont make sence

  1. #1
    Join Date
    Jun 2003
    Location
    London
    Posts
    14

    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.


    ceanth

  2. #2
    Join Date
    Nov 2002
    Location
    Hove, UK
    Posts
    160
    You probably need something like this:

    $cust_id = mysql_insert_id();

  3. #3
    Join Date
    Jun 2003
    Location
    London
    Posts
    14
    could you possibly give me an example situation of the code you mentioned.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles