Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

About SaranacLake

  • Rank
    Prolific Member

Profile Information

  • Gender
  • Location
    New York
  • Age

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Actually, no, I'm just trying to be a good developer and checking twice! Yes, if a Member lands on the "Trial Offer" page, that script will prevent them from adding the "Trial Offer" to their shopping cart. But I figured it would be a good idea in my checkout.php script to do an inventory of things and make sure everything is legit before I move forward. (Bad data has a crazy way of sneaking in place you never expect?!) So back to my OP... I was looking at some old old code, and it looks like I could just use PHP to iterate through the user's shopping cart records, and
  2. Hello. I'm trying to figure out the most logical way to update my shopping cart (table). When my checkout.php script loads, I need to run some checks on all cart items and take appropriate action. For example, a "Trial Offer" is only available to non-Members, so if a Member somehow has a "Trial Offer" in his/her shopping cart then I'd like my checkout.php script to remove that automatically from the Member's cart. So when checkout.php loads, one of the first things I do is to read the user's shopping cart items from the database. But what is the most logical way to upd
  3. @requinix Thanks, as always, for the help!! ๐Ÿ‘
  4. True. Told you I was rusty on all of this stuff... Right, I meant Session "files". I think I figured it out... That 2nd Session file is not from my code, it is from phpMyAdmin!! (Just for reference, should I ever see a query stored in my $_SESSION variable unless I am doing something crazy?? I would so, "No!")
  5. I don't know, it just seems like the $_SESSION variable should know/have it's own name?! ๐Ÿคจ So I guess I need to do this... session_start(); $_SESSION['sessionID'] = session_id(); var_dump($_SESSION); $sessionID = (isset($_SESSION['sessionID']) ? $_SESSION['sessionID'] : ''); exit(); And then I can INSERT $sessionID into a new SHOPPING_CART record? Oh, one other thing... When I look under tmp > php I see two session variables. The first one is consistent with what I'd expect and contains...
  6. I added an echo like this... session_start(); echo session_id(); //new var_dump($_SESSION); exit(); So that echos what appears to be my session_id, but... Why isn't session_id stored in the session when I create it?
  7. I finally found some useful info at php.net and found that PHP create a file for each new session and stores it here: session.save_path in the php.ini file. Questions: 1.) In my PHP code, what should I be storing in my shopping_cart table for the session_id? Is the file name that PHP create? 2.) And how can I capture that and store it in my table?
  8. Yeah, I looked at my login.php script and seems that, for logged in members, I store their "memberID" in the "$sessMemberID" variable. So let me back up and explain why I'm asking about all of this. Right now I am working on building code to add items to the user's shopping cart. In my SHOPPING_CART table, I have a column for "member_id" which works great is a user is also a member and logged in. But for members that are not logged in, OR for users who are not yet members, I want to use the Session "session_ID" who that I can store whatever a user put into
  9. I could use some help remembering how sessions and cookies work... (Looks like another thing I have forgotten about!) In one of my old scripts, I start a session using... session_start() And then I have... $sessMemberID = (isset($_SESSION['sessMemberID']) ? $_SESSION['sessMemberID'] : ''); It appears my old naming conventions aren't so clear after being away for several years... In my database I have a MEMBER.id (table/column) which is just an AutoNumber, and I thought that PHP create a "Session ID" but that it was some long hexadecim
  10. In one subtype I have a field called "title" and in another substype I have a field called "name". When I use a UNION, I am able to get them to appear in the same column, but it seems that the column name adopted is just the first query SELECT p.id, p.sku, mp.product_id, mp.name FROM product AS p INNER JOIN membership_plan AS mp on p.id = mp.product_id UNION SELECT p.id, p.sku, bk.product_id, bk.title FROM product AS p INNER JOIN book AS bk on p.id = bk.product_id How can I "shift" things so my final query shows the columns: id, sku, name, title w
  11. You proposed EAV which is a whole other beast. It's also a different design that I'm not suing. Is a UNION the way to go with my current design?
  12. Here is a little more of what (I think) I'm trying to do... PRODUCT (parent) - id - product_type_code - sku BOOK (subtype) - id - product_type_code - title - thumbnail SHIRT (subtype) - id - product_type_code - name - thumbnail I am trying to build a query that can be used to display all items in a person's shopping cart. Because I have disparate subtypes, some things won't match up - which is why i decided to create subtypes in the first place - but things like a product's name, description, and thumbnail should be universal for any sub
  13. My database has parent Product table and multiple sub-type tables like Books, Tshirts, Gear, etc. I need a way to display everything in the Product catalog including details only found in the sub-type tables. How do I do that? When I tried multiple INNER JOINS my query didn't return any records. Maybe I need to use a UNION?
  14. Hello. I could use some advice on the best way to handle my shopping cart. My website will sell subscriptions along with more traditional items like books, t-shirts, etc. For subscriptions, I have these business rules... 1.) Only non-members can purchase a "trial subscription". 2.) Once you are a "member", then no more trials for you! 3.) You can purchase multiple subscriptions (e.g. into the future), BUT I only allow you to purchase ONE subscription at a time. (My system would allow multiple purchases at once, but I don't ant people accidentally signing up for 2 yea
  15. @kicken Okay, thank you, that is helpful! Okay, point taken. Yeah, in the past I relied more heavily on $_SESSION, although with any data, I always try to check it against the database to make sure it wasn't manipulated! I welcome being corrected on semantics, and "pedantics" makes for better programmers! ๐Ÿ™‚ Based on what you said above, I guess what is happening is that the user requests trial-offer.php and the server serves that page up to the user's browser which in turn displays the web-form.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.