Larry
Administrators-
Posts
5413 -
Joined
-
Last visited
-
Days Won
155
Everything posted by Larry
-
Cookie And Session Problem
Larry replied to johannsnr's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
Kudos for resolving it and thanks for letting us know. The site looks nice! -
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.
- 3 replies
-
- procedures
- add_customer
-
(and 1 more)
Tagged with:
-
tinyint mysql
Larry replied to johannsnr's topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
You'll also need to change the stored procedure, I believe. -
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.
- 3 replies
-
- procedures
- add_customer
-
(and 1 more)
Tagged with:
-
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!
-
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.
-
Downloads
Larry replied to mikeo's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
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! -
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.
- 6 replies
-
- php
- javascript
-
(and 1 more)
Tagged with:
-
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)?
- 6 replies
-
- php
- javascript
-
(and 1 more)
Tagged with:
-
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).
-
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?
- 6 replies
-
- php
- javascript
-
(and 1 more)
Tagged with:
-
Errata V.1
Larry replied to Trick_Master's topic in PHP for the Web: Visual QuickStart Guide (5th Edition)
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! -
Downloads
Larry replied to mikeo's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
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? -
Get Method
Larry replied to MaartenFeldmann's topic in PHP for the Web: Visual QuickStart Guide (5th Edition)
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. -
Sanitizing My Data.
Larry replied to mike316's topic in PHP for the Web: Visual QuickStart Guide (5th Edition)
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! -
Sanitizing My Data.
Larry replied to mike316's topic in PHP for the Web: Visual QuickStart Guide (5th Edition)
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.