Back to my shopping cart code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tokunbo
Forum Commoner
Posts: 46
Joined: Thu Sep 29, 2011 8:53 am

Back to my shopping cart code

Post by Tokunbo »

A pleasant day to you sirs,

I'm back to my shopping cart coding. Previously, it stopped here:
http://www.devnetwork.net/viewtopic.php ... 3e06c5b0bb

I have gone this far:

1) I can add records to my DB. User selects a product, enters a desired quantity (value) and clicks the "add to cart" button.

2) The cart is displayed on the sidebar. It shows the product name and "entered" quantity = whatever the user keyed in earlier.

3) I can delete records from the cart / DB.

4) I have a session_start() at the beginning of the order page.

After the user "finishes ordering" user should fill up a contact form (name, add, phone#) at the bottom of the same page, and click the submit button. CLicking the submit button should send the order plus contact details to an email addr.

For example: a user first added 10-products to the cart, and decided to remove 3(three), so it remains 7 products in the cart. For testing purposes, I have the sessionID, productID, Product name, etc displayed somewhere on the page so that I can verify things are working properly - for a present session.

Now, I want to write two things to a file: (1) the remaining contents of the cart using the present sessionID as a reference, (2) the users data - to the same file for email purposes.

question) how do I query my DB for data(product name, quantity, etc) with respect to the present sessionID of user xyz; considering that two users might be making the order at the same time.

the answer given by Mr. Twinedev in this conversation (http://www.devnetwork.net/viewtopic.php ... 3e06c5b0bb) produces an empty text file.

warm regards
Tokunbo
Post Reply