A few questions

Results 1 to 2 of 2

Thread: A few questions

  1. #1
    Join Date
    Dec 1969

    Default A few questions

    Now I have a few questions, but I will go at them one at a time, in this tread :)<BR><BR>I am currently developing a script to make a shopping cart. Now I have it already done, in a way I have figured it out, but its not quite the way I would like it to be done. The way I do it now, is once a user clicks on an item that they want to place in there checkout, an array is stored into the session, this array has the all the information about the product, product category, the actual product, the description, etc. Then when they go to checkout.asp, I use Session.Contents to grab all the session varibles that are arrays and format them and output them to the page.<BR><BR>Now if this way is a good way to do it, please tell me so. But if you know a better way to do it, then tell me :)<BR><BR>The way I REALLY want to to do it is have an array tha tis stored in teh session with all the ID&#039;s of the products that were clicked on, this way I could just use the ID to referance the whole product in the DB.<BR><BR>What do you guys think?

  2. #2
    Join Date
    Dec 1969

    Default RE: A few questions

    I would probably do both a session variable and in a Cookie too!<BR><BR>That way if session expires (Even if only 5 mins or so) then they dont have to start over.<BR><BR>I would probably use a String instead of an Array.<BR>Build your string so it looks like this<BR>Always adding on an ID followed by a Comma ","<BR><BR>121,142,186,456,<BR><BR>Reason Id do this is it makes it pretty easy to work with...<BR>They want to remove one?<BR><BR>Session("IDS") = Replace(Session("IDS"), "142", "")<BR>Gives you this<BR>121,186,456,<BR><BR>When time to display what they Chose<BR>Just trim off the Very last comma...<BR>strIDS = (TRIM THE COMMA)<BR><BR>Select * From ITEMS Where ItemID IN(" & strIDS & ")"<BR><BR>Retruns all you need...<BR><BR>This was a basic example<BR>Other might have other ways im sure...<BR><BR>Sorry all i have time for.<BR>Out the door for the afternoon.<BR>

Posting Permissions

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