Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Posts posted by Larry

  1. You're quite welcome. And, actually, I'm glad you've raised this question, because it's what I intended with the book: take what you want from the two examples to make what you need. Thanks, too, for your interest in the JavaScript book.

     

    In answer to your question, yes, it's the difference in storage method (or, technically, association method) that would suggest separate tables. In theory you could use the same table for both, with a user_session_id column AND a customer_id columns. For logged-in users, the customer ID gets used. For guests, the user session ID. Proper database design suggests not to have columns with lots of NULL values, which such a table would. But you'll need to slap some logic on the system one way or the other (unless, like Amazon, you insist upon login for wish list manipulation).

  2. Thanks for the nice words. I've read part of this book and can recommend it: http://www.amazon.com/Objects-Patterns-Practice-Experts-Source/dp/143022925X/ref=sr_1_3?s=books&ie=UTF8&qid=1301063737&sr=1-3

     

    I don't know this book, but I've heard excellent things about the author, David Powers: http://www.amazon.com/PHP-Object-Oriented-Solutions-David-Powers/dp/1430210117/ref=sr_1_1?s=books&ie=UTF8&qid=1301063737&sr=1-1

     

    I'm not familiar with this book or the writer, but the publisher puts out good books and it gets good reviews: http://www.amazon.com/Object-Oriented-PHP-Concepts-Techniques-Code/dp/1593270771/ref=sr_1_6?s=books&ie=UTF8&qid=1301063737&sr=1-6

     

    Please let us know if you find a book that you particularly like.

  3. This is just a note to say that I haven't officially created any "Review and Pursue" threads in this forum yet as I didn't know what, exactly, readers would want. So feel free to post your questions as you have them and I'll answer them as they come. In time I may then shuffle things around to create an organized "Review and Pursue" system. Thanks for your interest in the book!

  4. If I were you, I'd make a decision about requiring login or not. Because if you want a permanent wish list, that requires login and you would store the customer ID in the wish lists table. If you want non-logged-in users to have a temporary wish list, as in the book, you'd use the cookie. If you want both features, I would use two separate tables, But then there might be issues about transferring non-logged-in wish list items to the other table when the user later logs in. So, it's complicated.

     

    As for the HTTP/HTTPS gap, I'm not sure what I was thinking before, but I think you're right: it's just the same issue that's already been overcome.

  5. My question on Ch 8, Coffee example.

    in my browser page (http://localhost/phy.../goodies/Mugs/3), error message is displayed in a box:

     

    Error!

    Unfortunately a system error has occurred. Please use the links at the top of the page to continue shopping. We apologize for the inconvenience. .

     

    How to solve it? Appreciate your help.

     

    Okay, so you see that result if this conditional is not true:

    if (!$type || !$sp_type || !$sp_cat || !$category) {

     

    So to debug this, just before that line, I would echo out the values of those four variables.

  6. No, you don't want to select the other table there. That query just gets the list of categories. Your edit script should have a separate query that retrieves all the information for the page being edited. That query should also be selecting the page's current category ID. It's this value you would compare to within the loop to determine which row gets pre-selected. Once you get that working, you can then add that code that watches for "stickyness".

  7. Well, the header and footer and CSS could or could not dictate the layout of the page, depending upon how everything is put together. So you could just create the X columns in the primary file and the header, footer, and CSS are the same. Or you could create one header, footer, and CSS combo for the X column layout and another for the Y column layout. If that's the case, you'd just include the other header, footer, and CSS combo when a different style is needed.

  8. Thanks for the nice words on the book and for the specific feedback on the advanced queries. Much appreciated. I'm also glad you felt the book was distinguished from the others (and thanks for the continued interest in my books!).

     

    As for your question, you're right on target. However, you don't need to change Carts and Wishlists and user_session_id. You could just store the user_session_id in the customers table each time they log in. Then the other functionality stays the same.

     

    You could do what you propose and change the uses of user_session_id to customer_id, but the only real change required to the stored procedures would be that customer_id would be an integer and not a string. However, the trick there is that you'd need to store the customer ID in a cookie (on the public side), which is a bad ID. Or you could store it in a session, which would be better, but then you'd need to use sessions on the public side and visibly pass the session ID to the checkout process (the HTTPS), which isn't ideal.

     

    And that's really the trick here: bridging the HTTP/HTTPS gap (because the same cookie isn't available in both).

     

    Does that make sense or did I just say a lot without actually answering the question?

  9. Thanks for the nice words. The issue is that PHP is unable to send out the email with the error that occurred. The solution to that depends upon the OS in use, the mail server in use, and the version of PHP in use, none of which do you indicate (per the forum guidelines).

     

    You also have a problem in your conditional. It should be

    if (!$live)

     

    The emails should be sent out if the site is live. If the site is not live, the errors should be displayed in the browser.

×
×
  • Create New...