Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. If this does happen--and it may happen some day by accident--the web browser will just hang and never completely load the script (because the server is still running it). Simply close that browser tab! Something like this, while unnecessary, isn't actually a heavy burden on a web server.
  2. Kudos for resolving it and thanks for letting us know. The site looks nice!
  3. If I recall correctly, the second example in the book--that used the stored procedure--was designed purposefully to allow the same person to buy multiple times without registering. Which both explains what you're seeing and isn't a problem.
  4. You'll also need to change the stored procedure, I believe.
  5. That's a great question! You'd want to decide whether to have the stored procedure check for an existing customer or do it separately. If you have the stored procedure do it, you'd have to modify it to return an error message in that case. It'd be simpler to run a SELECT query outside of the procedure first, though, and then use the logic you have posted.
  6. Thanks so much for the nice words! I really appreciate it (and I owe you a reply to your email, too; sorry!). Did you use the sql.sql file from the book's downloads (the GitHub) repo to create the table? If so, this is probably my fault. That erroneously had the password set to CHAR(40) when it needs to be CHAR(128) for Ch 9. I've since fixed that, but if your table is CHAR(40), it's not storing the full password. (The SQL command in the printed book is correct.) Sincerest apologies if that's the cause of this!
  7. To be clear, the translations work like so: 1. The user selects their preferred language from the pulldown menu. 2. This stores the preferred language ID in the session. 3. A query pulls all the keywords in the preferred language from the database using that ID. 4. Places in the PHP code then use the translated text. To debug this, I would work it through in that order. First make a language selection. Then confirm the stored language ID by printing out the session value. Then run the retrieval query on the database directly using that ID. Then check the PHP where it doesn't seem to be using the translation.
  8. Thanks for buying the book and even putting in the effort to do so! Thanks, too, for reporting those mistakes. I've updated the SQL file. Cheers!
  9. Sorry, to be clear, in Google Chrome, view the Developer Tools. Then look at the "Network" pane. You should see requests there to your server-side PHP script. These are the JavaScript "Ajax"/XHR requests. If there aren't any, then the problem is with your JavaScript. If there are requests, you can click on one for more information. The "headers" pane shows what was sent to the PHP script and the "response" pane shows what the PHP script returned.
  10. Sorry, but I'm not quite following what you mean. What is the response from the PHP script? The actual body (this should be viewable in the developer tools, too)?
  11. You shouldn't have a problem using the book with PHP 7. And, yes, your process looks fine, you'll just need to configure things appropriately further down the line (e.g., you'll want to create a local URL so that http://ex1 points to c: \ wamp \ www \ studybybook \ bookecommerce \ ex1).
  12. So...just to confirm, have you verified (using the developer tools in Chrome) that the request is being made of the server-side PHP script and confirmed what that script's response is?
  13. Ugh! So sorry. I completely missed this somehow. I've never seen the Kindle version but I assume it is different in some ways in that it's a different format. Sorry about any problems you're having with it!
  14. Mack, the original poster was looking at the wrong scripts and repo. I'd double-check that you're not doing the same. If you are looking at the right scripts and repo, could you provide an example of what you're specifically having difficulty finding?
  15. Whohoo! A real book in a bookstore! That's awesome. Yes, the bootstrap stuff is completely optional, it just won't look as nice. I only use it b/c it brings a little bit of nice design without any design skills! Sorry to hear about the problems you're having accessing sites in China!
  16. Ugh! So sorry. I completely missed this somehow. The ? is how additional information is passed to a page in the URL. In other words, it's not part of the URL that identifies the page to view.
  17. Hmmm...it's most likely b/c the live server isn't configured the same way, likely not having the same extensions, I imagine. You should turn on display_errors or look at the error logs to see the actual error occurring. Knowing the actual error is the only way to debug this.
  18. If you look at the book and the source code, you'll see there's a table with one row for each language and one column for each word. Translations then occur by creating records of each word in each language.
  19. Cool! Sorry I wasn't able to chime in, but kudos for solving it and thanks for posting the solution!
  20. For me, the variable declaration up front is a protection tool (e.g., you'll get notices if you refer to a variable that doesn't exist) and negates the need for using else clauses in your validation. Largely, though, it's a matter of personal preference, so long as you never assume a variable exists when it might not!
  21. Hmmm...I can see the arguments on either side. The response you received in that other forum makes sense in a context, but I don't personally subscribe to the "avoid changing the user's data" argument. Really depends upon the context. Your script is a simple contact form example with blunt sanitizing. The point of the filtering of user-submitted content in this script is to prevent the page from being used to send spam. It also depends upon whether you want to use sanitizing as part of validation or not.
  22. Cool! As for the session cookie it only gets deleted if you actively call setcookie() to remove it.
  23. Excellent! Could you kindly share the solution so that others might benefit? Thanks!
×
×
  • Create New...