session variable vs. table entry vs. hidden fields

Results 1 to 5 of 5

Thread: session variable vs. table entry vs. hidden fields

  1. #1
    Shilohcity Guest

    Default session variable vs. table entry vs. hidden fields

    Hi there<BR><BR>I have read all sorts of opinions regarding the use of session variables vs. querystrings vs. database entry etc.<BR>and was wondering if anybody had any tips for my situation.<BR><BR>I am in the process of building a shopping site and am planning to use a mix of hidden fields and database entry to manage the cart of the shoppers. One of the problems I can forsee is related to the maintaining of orders, my confusion is this:<BR><BR>user selects items 1, 4 , 6 and orders 2, 6, 8 quantity of each. <BR>This is entered in table as a string itemid=1, 4, 6 and quantity=2, 6, 8.<BR>If they then choose to order 4 of item 1 and I use an update query it will overwrite the current strings with itemid=1 and quantity=4<BR><BR>Maybe I should hold all the items, quantities etc as hidden fields? or maybe I should use a session variable.<BR><BR>Well feedback is appreciated on this especially as my hosting company has threatened to go through my code line by line to prevent server degradation at $100.00 an hour EEEEEEEKKKK!!<BR><BR>Cheers muchly<BR><BR>Justin.

  2. #2
    Join Date
    Dec 1969
    Posts
    1,362

    Default RE: session variable vs. table entry vs. hidden fi

    well<BR><BR>Server degradation... don&#039;t use session on a shopping site<BR><BR>Reason: What the heck happens if you are really busy at x-mas or before deer season. <BR><BR>Some people dig using cookies.<BR>I like a combo of hidden form fields,<BR>i would use a db, but store each item/quantity as a sep record,<BR>with that persons shopping id. That you could use a session for, but in that case, a cookie is a better idea.<BR><BR>just a little help, if it really is in fact help.

  3. #3
    Join Date
    Dec 1969
    Posts
    1,203

    Default db design enclosed:

    tblCart_Items<BR>id<BR>sessionid<BR>item_id<BR>qua ntity<BR><BR>Hold one item per record. It is poor database design to try to fit multiple items into the same record as you are trying to do. A nightmare.

  4. #4
    Shilohcity Guest

    Default thanks and a questions

    Thanks for your suggestions.<BR><BR>I was beginning to see the problems with storing multiple items in the one record already so was planning on changing this so thanks for confirming my thoughts. <BR><BR>One question though, at present I have a page displaying all orders placed that simply draws data from table splits the strings and displays it all neatly. If I am going to split the order across multiple records how would I go about grouping the recordset so it still displays items from the same order together?<BR><BR>Cheers<BR>Justin.


  5. #5
    Shilohcity Guest

    Default Never mind I think I got it sorted

    sql="SELECT * FROM itemorder GROUP BY customerid WHERE status = "confirmed"<BR><BR>should work I hope.<BR><BR>Justin.

Posting Permissions

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