Jump to content
Larry Ullman's Book Forums

Larry

Administrators
  • Posts

    5413
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by Larry

  1. That code doesn't turn all your links into HTTPS links. That code ensures that register.php and the admin directory are accessed via HTTPS. What turns all the links on register.php into HTTPS links is the use of relative links. Since register.php is HTTPS, any relative link on that page is HTTPS. To get people to pages via HTTP, create absolute links to HTTP.
  2. "KEY" is just another term for INDEX, so the CREATE statement creates an index on that column, as it's a foreign key to the other table. The purpose is to improve the performance of those JOINS. You can, by the way, define foreign key constraints in the table structure, depending upon the version of MySQL in use, and if using the InnoDB storage engine.
  3. Yeah, many of the things that I talk about in the book as being planned for PHP 6 ended up in PHP 5.3, in places like the SPL (Standard PHP Library). I'm trying to figure out how to introduce the SPL in the fourth edition of this book. The third edition of my PHP Advanced book will probably cover it in detail.
  4. I can, certainly, based upon the documentation at the PHP manual (http://us3.php.net/collator). However, it's only useful if you're using PHP 5.3 or greater with version 3.6 of the ICU library or greater installed.
  5. PHP 6 has gone away since the book was written. Depending upon what version of PHP 5 you're using, there is an alternative solution using the Collator class.
  6. Check out the PHP manual's page for the exec() function to see how to assign the output of the command to a variable. Or you could use the system() function.
  7. I generally agree with Stuart here, although an alternative would be to create a custom_fields table, with the various properties, and a custom_fileds_data table. That table would store the custom_field_id, the user's data, and a link to the other table that stores the non-custom user data.
  8. Hey Stuart, I'm glad that Zend_Lucene article was useful for you. Good luck with your project. I would be inclined to keep the files organized as they are, at least because it's convenient and easiest. There can be performance issues putting too many files and directories in one folder, but it depends upon the OS in use.
  9. The mysql_fetch_object() function is just an alternative way of fetching a record from the database (an alternative to mysql_fetch_array()). It isn't pertinent to downloading blobs, for the record. But please feel free to share your code.
  10. You're welcome. As for this question, what version of PHP are you using? It's pretty important information, which is why the guidelines specifically recommend that you include it. In fact, if you want fast answers, I would recommend reviewing the guidelines, because there are lots of good suggestions there.
  11. Thanks, guys, for this thread. It's a good one. The order in which you list the tables should not impact the results so long as you're using INNER joins and I generally agree with what Matt said about how he views this. One thing to consider, though, is performance: the faster you can narrow down the result, the better. I would recommend taking this experiment a step further and running different versions of the same join through EXPLAIN queries to see if MySQL thinks it would handle one ordering of tables better than another. You could benchmark the join in different orders, too, but benchmarks have a way of not being accurate.
  12. That seems to make a lot of sense to me. As for using a function vs. an included file, HartleySan has a point, from a theory perspective. However, whether you use a function or an includable file, you only have one bit of code to ever edit. I would argue that creating a script that just defines a function and calls it is the same thing as creating an includable file that does the same work, except that if you define a function, you require a lot of extra memory overhead for something that only gets done once. Seems wasteful and unnecessary to me, but I can appreciate the desire to wrap functionality in a function. That's why I suggested creating a page that's run directly that does all the work: it seems less kludgey. Glad you figured it out!
  13. Hello Matt, I think frameworks could be considered "taking the easy way out". The fallacy is in thinking that taking the easy way out is a bad thing. We all take the easy way out with all sorts of things all the time. It's up to you, the programmer, to decide whether taking the easy way out is appropriate for a given project. Now as for US foreign policy...
  14. The reason the dates aren't showing up is because you haven't installed time zone support in MySQL. See Chapter 14, I believe. As for why only some forums work, not all forums have language keywords and/or postings, so they revert to English (per the code).
  15. If you're using InnoDB tables and have foreign key constraints implemented, then deleting from the parent table (e.g., users) will automatically delete from the child table (e.g., comments).
  16. Yes, everywhere you cal a MySQLi function, you must change the arguments to match what's appropriate for that function.
  17. And you need to expand on what you mean by "it does not work". That's too vague. How it's particularly not working is relevant for debugging purposes.
  18. And when that URL is loaded in a popup window, IE gives you a "cannot display the web page" error? What happens if you load that URL directly? What happens if you use a different browser?
  19. What I was asking previously, which perhaps was not clear, is what is the URL in the browser's address bar that does work? It shouldn't be anything that starts with a period.
  20. Run a phpinfo() script to confirm which configuration file is active. I suspect is the first one mentioned, and the one in the bin directory is for command line PHP.
  21. And that, of course, is why it's important to include all the relevant details when you ask a question here. A note I've given you on several occasions, I believe.
  22. No, you can't load multiple images using one script. Each use of the script can only send one image. To have a page display multiple images, you'd have multiple calls to the same PHP script.
  23. Thanks to HartleySan and Paul for helping out and thanks to the original poster for the nice words on the book.
  24. Thank you very much for the nice words. I'm glad you like what I do!
  25. What is the "correct" URL in the address bar for the popup window?
×
×
  • Create New...