View Full Version : Give me a solution

01-06-2007, 10:39 AM
i have developed a shopping cart page.
whenever i add a item to the cart i will insert the details into the database table .
but i force the user to login to proceed with the shopping.

The problem is whenever a user logins and continues shopping there will nt be a pblm because i have the Customerid maintained in the database table.

But whenever defaultly i add an item before logging in how can i track the details if some other user tries to add in the same manner.

please provide me a solution ASAP.


01-06-2007, 11:05 AM
You can store temporal information in a cookie. Or in a server session.

01-06-2007, 11:13 AM
can u please explain it more.
i am gettng stuck up in doing wth that part.
every time if its logd in or not i am adding it to a databse table then .
if i login and add then its nt a pblm for me bcaz i hv the custid.
bt if not .

01-06-2007, 11:29 AM
Generate a temporal CustomerID and save it in a cookie (persistent or session). If a user is not logged it, then assign the purchase to this temporal ID. Then, when the user logs in, just check whether there exists temporal ID and update the database records with the true ID of that specific customer.

01-06-2007, 11:41 AM
thanks for the solution.but one more doubt will ths work when multiple users browse the same page.

01-06-2007, 12:07 PM
Yes. When a user comes to the site assign her a unique ID and store it in a cookie. As each of the users will have their own ID, it doesn't matter how many user browse your site at the same time.

01-06-2007, 12:14 PM
thank you .I am trying with the same.

01-06-2007, 12:16 PM
can i go with sessionid for uniqueId.

01-06-2007, 12:21 PM
Yes. The only prerequisite for temporal ID is that it is unique and that you can read its value.

01-06-2007, 01:16 PM
thank you for the solution and i have done with the work.