Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Content Count

    5196
  • Joined

  • Last visited

  • Days Won

    143

Everything posted by Larry

  1. I expect the problem is you CANNOT test from localhost without SSL. If you use Let's Encrypt, you can get a free, legit certificate to use for testing purposes.
  2. Ah, okay. Kudos for figuring it out and thanks for letting us know!
  3. I forget if I have examples of this in the book--I suspect I do--but here's an explanation of options for you that should work: https://stackoverflow.com/questions/11693234/php-mysql-gets-value-of-out-parameter-from-a-stored-procedure
  4. If you look at the SQL chapters you'll see examples of how to do fulltext searches in MySQL.
  5. Thanks for reporting that! I'll have the publisher fix it.
  6. Yes, more or less. You'll want to change your naming scheme so that each row of input--which becomes a database row--ends up as part of the same array in PHP. You'll need to play around with what works, but if you do var_dump($_POST) in the PHP code that may help you understand what's coming in from the form.
  7. This is very good detective work and thanks for being so thorough. I'd start by ruling out cases 3 & 4, though. The links are going to come through with HTML entity versions, so %26. You'll never have & in the URL, so there's no need to test and handle that. I'm also not inclined to go to zero-width positive lookahead assertions; that'd probably just complicate things. I just did an online regex tester for case 2 and it matched the percent okay: https://regex101.com/r/AWJdX3/1/ Are you restarting Apache after making changes to the configuration?
  8. Okay, so this kind of thing is a bit tricky. Since you have multiple inputs that are all arrays of related records, I'd start by changing your naming scheme to make them all more overtly related. For example, you'd want exams[X][subject] and exams[X][grade]. If i'm following you on this. I'm not sure I am 100%. But the key is to make the association of the data overt like that. Let me know if it's still unclear.
  9. The browser just isn't finding the CSS file, which means the HTML reference to it doesn't match where the file actually is. Do you have a CSS folder with the correct CSS files in there? Like this: https://github.com/LarryUllman/phpvqs-5ed/tree/master/08
  10. If you remove the error suppression operator, you'll see the error messages. You should probably also use some conditionals in there, such as checking that mysqli_num_rows() returns 1 or more records before you attempt to fetch them.
  11. I'm not quite following your question but the most important answer is an included file can only be included once.
  12. Thanks for the feedback and the nice words! I'll look into this and get it fixed.
  13. So, per the error message, the constants are defined in mysqli.php. When you see this error message, your script is either including that file for a second time or trying to define those constants despite the fact they're already defined in mysqli.php.
  14. I just emailed you the same code I linked above. What happens when you run this? Do you see any error messages? Your last three posts don't include any details.
  15. This is strange. There's nothing in your PHP code that would explain this. Could you confirm the exact sequence of events and the result? So you're on a page with what specific URL? And then you click what specific link (and what is that specific URL)? And then the resulting URL is what?
  16. I can email you the code but it'd be the exact same file downloaded from here: https://github.com/LarryUllman/phpmysqlvqp-5ed/blob/master/ch09/script_09_03/register.php What happens when you run this? Do you see any error messages? Your last two posts don't include any details. I can't speak for other writers, but the code in my books is generally not for illustration purposes. It worked when I wrote the book! However, code is not like a light bulb that can be screwed in in any socket (and even light bulbs vary quite a bit). Code runs within an environment; code that worked on one environment may not work on another, although PHP works across most environments well. You haven't yet said what version of PHP and OS you're using, which may shed some light on the issue. As a database expert, I'm sure you can appreciate this. I could do a MySQL 5.3 dump of a database that can't be imported into a MySQL 5.7 database, let alone a MySQL 8. That doesn't mean the dump was invalid, just that it won't work as-is for all situations.
  17. Hey Dr. Kalpesh! Thanks so much for sharing what you're doing. That's just so wonderful to hear! Kudos for that and for the work you're doing!!! Thanks, Necuima, for sharing the specific chapter. That code can be found at: https://www.larryullman.com/downloads/phpvqp2_scripts.zip
  18. Okay, your current rule is: RewriteRule ^browse/(coffee|goodies)/([A-Za-z0-9\%\+\-]+)/([0-9]+)/?$ browse.php?type=$1&category=$2&id=$3 That looks correct but PCRE can be tricky. Your error message is odd, though, making me think maybe there's another problem. Does the browse script work for other categories? Can you load browse.php directly (it'll probably give an error but it should still run)? What happens if you go to localhost/browse.php?type=goodies&category=Books+%26+DVDs&id=3 directly?
  19. I would also double-check that you're running/editing the file you think you are (this chapter has multiple versions of register.php). And if it's still not obvious what's going on, please confirm your PHP version and OS. Oh, and when mentioning errors it's best to include the specific error that you're seeing. Thanks!
  20. Yes, the code in the book does work. I used it while writing the book and for all the images I took. I'm a bit confused by what you're saying in this last post, though. I just downloaded the script from the site and ran it again, unedited. Here is the initial load: And after clicking "Register" without entering anything: I'm not seeing a parse or other error.
  21. Yes, the code in the book does work. I used it while writing the book and for all the images I took. I'm a bit confused by what you're saying in this last post, though. I just downloaded the script from the site and ran it again, unedited. Here is the initial load: And after clicking "Register" without entering anything: I'm not seeing a parse or other error.
  22. Hmmm... I don't see anything obviously wrong. That normally means there's a gremlin character in there, like a straight quote that's actually curly or the like. These aren't as easy to debug. I'd try retyping or copying-pasting the first few lines (from a clean source). Otherwise you'll need to debug backwards to find the exact line causing the problem. For example, if you remove line 10 (which you can do here without causing a new parse error), does the current error go away?
×
×
  • Create New...