Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Larry

  1. Oh, hey, that's awesome! Kudos and thanks for letting me know!
  2. Ah, okay. Thanks for explaining! I guess my inclination in this case would be to make a command-line utility that does the work you want to do and you provide this utility with the path to a file when you invoke it. The main issue in my mind is that "uploading" a file from a computer to itself is a marker of making a process more complicated than it needs to be. You could also write the command-line utility to accept a directory as an argument and then iterate through that directory. Let me know if this is still unclear.
  3. Thanks for the update. I'm still a bit confused by the scenario. If PHP is running on the same Windows machine as the files, then it should be able to access the full path. If not in the web version of PHP (presumably due to permissions), then the command-line PHP can. Apologies if I'm missing something.
  4. Ah, okay. If PHP is running on your PC (on a webserver there) you can definitely access the file system using PHP.
  5. I imagine it _may_ be possible but it's the kind of situation where I feel like the answer is "this is probably not what you should be doing". In that it feels like you're only using PHP here because you're most comfortable with it. If you're starting with C++, my inclination would be to try to do all the work in C++. But let me know if I'm missing something.
  6. If you put the file in a folder named "ch01" then the URL would be http://localhost/ch01/first.php.
  7. There could be several reasons why. To debug it, you'll want to take the src value for the img (from the browser HTML source) and run that directly in a browser to see what, if any, PHP error is reported.
  8. Thanks for the information! Could you clarify what edition and version (e.g., print) you're using? Thanks!
  9. Hmmm... you could put the error suppression operator before mail() calls, although you could also just comment out the mail() calls, for that matter.
  10. What's the actual problem you're having? What errors are you seeing, if any? All that being said, there's kind of a lot of problems with that code from a design standpoint. Way too much undocumented magic going on. The dynamic fetching of specific fields is dubious.
  11. You either initialize the variables before you reference them or maybe they should be coming from an HTML form.
  12. That means your SELECT query isn't working. You'll need to run it separately on the server to see what the results are (i.e., what the error is).
  13. Sorry for the delay. I wanted to remind myself of why I did what I did...which I may now remember. Maybe! I'm still a little bit confused b/c the page numbers you reference for the "Effortless E-Commerce" book don't match up with those in the printed copy of the 2nd edition. But I think I get what's going on...by looking at the SQL commands for the second example in the "Effortless E-Commerce" book, (which is the one with "customers" and "orders" tables). Foreign keys are a (normalized) database concept, in which a column in table A represents a column from table B. There are also foreign key *constraints*, which is an aspect of the database application, enforcing the existence of a foreign key. This is what you're seeing on page 197- in the "PHP and MySQL" book. The SQL in the "Effortless E-Commerce" book has foreign keys but not foreign key constraints. There's a tip on page 193 that says you could add these. As a rule, a database must have foreign keys in order to use foreign key constraints but a database can have foreign keys without foreign key constraints. Separately, and perhaps the confusion here, MySQL will use the word "KEY" as synonymous with "INDEX". This is just saying that MySQL should index--i.e., track--the values in that column. Because, as a good rule, you should index foreign key columns. So! The reason everything seems to be behaving differently for the "Effortless E-Commerce" tables is because they don't have foreign key *constraints*. Let me know if this is still not clear or if you have any other questions (and I'll reply more promptly, I promise!).
  14. Good question! Actors have a many-to-many relationship with movies because each actor can be in multiple movies and each movie has multiple actors. A rule in this model is that each movie only has a single director, so there's a one-to-many relationship between directors and movies (although in real life some movies have more than one director these days).
  15. Well, different technologies go through trends although that tends to be more impactful to new businesses and work b/c, say, an existing PHP company/site is going to need a PHP person. We're definitely in a time wherein there's a lot of talk about server-side JavaScript. That may stay or go, though. And it's totally fine. I think all arguments about X language encouraging bad code are pretty silly. You can be a good or bad programmer in any language! Your best bet would be to look at some actual job markets, whether it's for full time jobs or freelance work, and see what they're actually looking for. I suspect you'll find no clear winner or loser. For what it's worth, generally speaking companies with existing IT departments will likely have opinions on what tech they want to hire for, but on the other hand, I work for a company that's primarily a Ruby shop and they hire more than just Ruby developers. If you're a good developer in any one language, there's potential for you to be a good developer in another. Developers understand theories and practices; languages are largely a matter of specific syntax. Finally, in my previous experience, many of the people hiring a developer for a project don't know or care what tech you use so long as you can do the job at the right price.
  16. What operating system are you using? Generally, though, I don't worry about trying email locally and just wait to test that stuff using a hosted server.
  17. You're getting this error because the $row variable doesn't have an element indexed at "description". $row comes from the stored procedure, so either there's likely a flaw in your stored procedure definition.
  18. Sure thing! If you work it backward, the title is set in the HTML HEAD, which means it's in the header file. So, due to the way includes work in PHP, the script would need to have the user information prior to including the header.
  19. The setup and population commands are in the sql.sql file in the root directory of the scripts.
  20. Just open the unordered list before the foreach loop and close it after. Then, within the loop, print $day within <li> tags instead of using break.
  21. Thanks for the question and for the nice words! I would say in terms of familiarity with the concepts, you'd be an intermediate PHP developer by the end of this book. Maybe a low-end intermediate if I'm being conservative. The main thing you'd need from there is practice and experience, which no book can give you. Just a matter of doing now!
  22. There are no scripts for those chapters because they only use MySQL.
  • Create New...