Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. See this: http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html
  2. ANSI (aka Windows-1252) uses 8 bit, but UTF-8 uses up to 32 bit, so that depends on the contents of your file. You can also just remove the BOM from the file. According to this page, the BOM is represented by the character sequence EF BB EF (in hexadecimal) in UTF-8, so you can just remove that from the file: $contents = substr($contents, 3, 0); If you want to make sure you only remove the BOM if it exists you can do like this: if (substr($contents, 0, 3) == pack("CCC", 0xEF, 0xBB, 0xBF)) { $contents = substr($contents, 3, 0); }
  3. It's a buzz word for a retro concept. Storing your stuff on a mainframe and using a thin client/terminal to access it.
  4. Not necessary. The code $array = array('foo' => 'bar'); echo "foo $array[foo]"; is valid and will output foo bar.
  5. Well, you haven't closed the string in $sql. Use an editor with syntax highlighting. It should give away errors like that.
  6. http://www.doctrine-project.org/documentation/manual/1_1/en/hierarchical-data#nested-set Sure In mathematics and computer science, a tree is a particular kind of (data) structure. Traversing a tree is the act of visiting each element in the tree, and you can do that in a number of different ways, e.g. preorder. This algorithm uses a slightly modified version of preorder traversal. I also just remembered that I had this in my bookmarks: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
  7. Use mysql_fetch_row.
  8. Doing like this is better: header('Location: destination.php'); Strictly speaking, the destination is required to be a fully qualified URL in the RFC, but all browsers work with relative URLs as well.
  9. Have you checked that it's actually output? Also, you should use a proper header for redirecting.
  10. Yes of course. That's a typical tree structure. You can do it in a simple way by just storing a parent id on all elements (with null if it's the root). A better choice would be to use something called the "modified pre-order tree traversal algorithm" (also sometimes called "nested set"). It's more complex to implement, but it's more efficient when reading from the database. Doctrine has got an implementation of nested set that you can use.
  11. That won't work. $_SERVER['DOCUMENT_ROOT'] contains the path to the document root on the filesystem
  12. Is that within the scope of some function or something? $HTTP_POST_VARS is not a superglobal like $_POST is. Also $HTTP_POST_VARS has been deprecated since 4.1.0, so throw your book away and buy a new one!
  13. "I'll buy almost anything that's shiny and made by Apple."
  14. Daniel0

    Google Wave

    I've started a public PHP Freaks wave for people to post all their random crap in: https://wave.google.com/wave/#restored:wave:googlewave.com!w%252BKNv70s8IC If that link doesn't work, just search for with:public "PHP Freaks Public Wave". I wonder how many people here that actually has got an account...
  15. ... what? That post doesn't make sense.
  16. Also: http://www.phpfreaks.com/tutorial/working-with-dates-in-php
  17. This essentially comes down to operator precedence, which you might want to learn. Also note that and takes lower precedence than &&.
  18. Relative to what? What do you want the output to be? nigeria/images/uploaded/1/71256119068_51fe7f0fd342377.jpeg? In that case, just strip off the document root from the string.
  19. According to Google, this requires the use of Smarty and the mailto plugin to achieve. Unless you're already using it... I take it you missed the memorandum. Smarty is officially the be-all and end-all best thing ever.
  20. Personally, I think it's great. It's always nice getting a neater solution.
  21. Just download the source and compile it. There are only official binary builds for Windows.
  22. If you need more sophisticated matching than provided by the ctype functions, using regular expressions would probably be a better idea.
  23. Operating systems usually do not ship with PHP. It's trivial to install though.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.