Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Larry

  1. Thanks for your question! The difference between the 5th and 4th editions is somewhat minimal. The difference between the 5th and 3rd edition is significant. The difference between the 5th and 2nd edition is...oceanic! The 2nd edition is probably about 10 years old and I don't even know if PHP 5 existed then (the current version is PHP 7). So much has changed!
  2. Hmmm... I've not been in this situation before but I imagine you have three options: - Uninstall MySQL and XAMPP and then reinstall XAMPP - Try to configure XAMPP to use your existing MySQL install (I have no idea what that would entail) - Just install Apache separately and forgo XAMPP I'm not sure which is best for you, it would depend in part upon how the current MySQL install was used and whether you want the easy solution or the "interesting" one!
  3. Ah! Good question! The reason is because we don't want to assume the data will come from the form or in an unadulterated way. It'd be really easy to submit data from elsewhere to this script or to modify the form in the browser and then submit that. So these conditionals provide an extra layer of security.
  4. In answer to your question, the concise.css might have another class later on that's conflicting. Your best bet is probably to move on (CSS is hard if you don't do it fulltime and it's not critical to your learning at this point). Second to that, I'd use the developer tools in Chrome to see what CSS rules are or are not being applied.
  5. So could you confirm... - Running the "SHOW TABLES" command directly on the database returns multiple records (i.e., multiple results)? - The while loop is only executed once? - Do echo mysqli_num_rows($r) to see how many rows are in the result.
  6. That's all good info! The files should be just numbers without extensions, that's good. The next thing I'd do is run view_print.php?pid=1 directly in your browser and see the result. Hopefully you'll see a PHP error that explains what's going on.
  7. What is the HTML tag for one of the images that's not showing?
  8. Hey Jack. Right now you're literally passing the string "lid" around, which won't do anything. You should double-check how the book does it. (Separately, there's no method for A tags but that's not causing your problem.)
  9. Hey Marie. Thanks for the nice words! Truly appreciated. By PHP, I was wondering how the PHP script is encrypting the password that you're storing (e.g., using the password_hash() function). But if it's working now, maybe that's good enough!
  10. Marie, what is the definition of the password column in the database (its size in particular) and what are you using to encrypt the passwords?
  11. Thanks for your post and questions! I have been keeping the PHP & MySQL book up to date, and the 5th edition does reflect changes in PHP 7 (the book was written with PHP 7.1.7). I couldn't say for sure whether I'll ever do too much OOP in this particular book, though. It's a complicated subject--my PHP Advanced book spends hundreds of pages on it--and I wouldn't necessarily agree that MVC or OOP is ubiquitous in the PHP community. But these are the kinds of things I re-evaluate with each new addition and appreciate you raising the question!
  12. Yes, your understanding of the pros and cons of this scenario is correct. As for your questions... 1) The only way I know of or can imagine that being possible is by adding login functionality. When the user goes from browser A to browser B, they need to somehow tell the site "I am the same person". 2) Not hard at all! Part of the design of the two applications in the book was so you could take pieces you liked from either when creating your own solution. Here you'd take the login/logout functionality, plus the additional user database table and implement that within the new site. Then you need to tie the logged-in user to the tracking session. You'd still use cookies but in the database you'd associate the cookie value with a specific user. Let me know if you have additional questions!
  13. PHP scripts must be run through the web server application (e.g., Apache). To do that, the PHP script must be run through a URL. So if an HTML form posts to a PHP script, it must be run through a URL, too. Or, looking at it the other way, if you load an HTML page through the file system and then submit the form, the PHP script will be loaded through the file system and do nothing (but likely show the PHP code in the browser).
  14. Hello Badr! Thanks for the interest in the book and I'm sorry about the delay in receiving yours. You should reach out to Amazon about that. Unfortunately, though, I don't know anything at all about the sales or distribution of books, including getting the Kindle version for free with a print copy (although I can say I've never heard of that and it would surprise me if that were true). Sorry I couldn't help!
  15. I feel like using cookies is fairly standard--and reasonable--these days and is the right approach here. Sessions do also require cookies, or a somewhat complex workaround, and are more demanding of the server. All in all, sessions are a lot of work just to store a single number.
  16. Apologies if this is due to a book error, but your query uses "id" while the database table uses "quote_id".
  17. That's a fine solution! In the other thread I posted what I originally had in mind, though. With programming, there are many ways!
  18. It's more straightforward than you might be thinking. Here's how it starts: if ( (isset ($_POST['gender'])) AND ($gender == 'M') ) {
  • Create New...