sessions and duplicate entries

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
nutstretch
Forum Contributor
Posts: 104
Joined: Sun Jan 11, 2004 11:46 am
Location: Leicester

sessions and duplicate entries

Post by nutstretch »

I have a site which creates a session and uses that session id for the shopping cart id. I also use that is as the order id when they user goes to the checkout. Once an order has been confirmed by the user and they are going to the payment pages the shopping cart is copied across to the order table to store the details in. the problem that i am finding is that if some one goes this far but then decides to add more to they get a duplicate entry error message as there is already an order in the table for that id. Does anyone have a way i can get round this. I have put a message box on saying go any further and you can't add any more, but my testers seem to ignore this. Also if they decide to have a nother order and they haven't leaft the browser it still has the same session id.


Thank you in anticipation

Nuts
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

There are like three or four layers of logic that you will need to apply to this. First, you might now want to use a text message as a means of forcing your app to do something. Instead, if they get to a certain point, use your code to not allow them to go back and add. And after they have completed, use your code to destroy their session and start a new one so that if they do want to shop more, they can without keeping their original session id. These are just a few suggestions. I am sure you will get more in this thread.
Post Reply