PHP Knowledge Base Update -- July 11th, 1999

From: Date: Mon, 12 Jul 1999 09:18:21 +0000
Subject: PHP Knowledge Base Update -- July 11th, 1999
Groups: php.kb 
Request: Send a blank email to php-kb+get-15@lists.php.net to get a copy of this message
Thanks to the generous and helpful guys (even late on a Sunday night when I was setting up) at http://www.easydns.com you can now access the knowledge base with this simple URL: http://phpkb.e-gineer.com It will even redirect you properly if you want to use a nice URL for a specific page. For example, a question can be linked as: http://phpkb.e-gineer.com/view.phtml/qid/505 Cheers, Nathan ------------------------------------------------------------ How can I print out rows from a database as HTML? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/505 ------------------------------------------------------------ Justin Farnsworth A good example template to use is: // OPEN TABLE AS YOU WANT IT ETC $nrows = mysql_num_rows($result); for($i=0; $i<$nrows; $i++) { $A = mysql_fetch_array($result); print("<tr>"); #open row printf("<td>%s</td>",$A["col1"]); printf("<td>%s</td>",$A["col2"]); // .... // .... print("</tr>"); #close row } // CLOSE TABLE ETC ------------------------------------------------------------ Where can I get a list of all the php3_ settings for Apache? What configuration settings can I make for PHP in Apache conf or .htaccess files? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/506 ------------------------------------------------------------ Nathan Wallace, Rasmus Lerdorf, Teodor Cimpoesu, Jordan Krushen Just about every directive listed here has a corresponding Apache httpd.conf directive. Simply prepend php3_ to the start of the directive names listed here. http://www.php.net/manual/configuration.php3 There are some that can't be set in the .conf file though. For the definitive list, have a look at mod_php3.c in the source code. ...or, a shortcut would be server-info, if you compiled Apache with mod_info.If yes, enable it (search httpd.conf for server-info handler) and open http://your.server.name/server-info. Go to php3_module section and there you'll see all the config. settings available. ...or you can try this on the command line: httpd -L ------------------------------------------------------------ Does require() use file system paths or web server paths? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/508 ------------------------------------------------------------ Rasmus Lerdorf require() uses file-system paths, not web server paths. So require("/phpinc/vars.php3"); will look for the file vars.php3 in the directory /phpinc/ on your server. It does not look for http://www.yourdomain.com/phpinc/vars.php3 The best approach is probably to define your include_path. For example: In your httpd.conf file, put this: php3_include_path .:/some/path/phpinc Then simply do: require "vars.php3" and PHP will first look for this file in . and then in /some/path/phpinc ------------------------------------------------------------ How do I use clearstatcache()? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/509 ------------------------------------------------------------ Matthew Clark According to both the PHP source (functions/filestat.c) and previous experience, clearstatcache() takes no arguments and returns nothing. clearstatcache() simply clears the cached results of stat() & lstat() calls. http://www.php.net/manual/function.clearstatcache.php3 ------------------------------------------------------------ What PHP type is used to hold values from a database? Why are all results from a database query made into strings in PHP? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/510 ------------------------------------------------------------ Rasmus Lerdorf It's a feature. PHP has 3 basic data types. Databases have many many more times that. Attempting to map 50 datatypes into 3 is going to be extremely messy. PHP2 worked like that and it was extremely confusing. PHP3 is consistent and always does the same thing, so there is no confusion. You always get strings and you never lose data nor precision. It is better to leave it up to the script writer what to do with the data than having PHP magically trying to determine what to do.

« previous php.kb (#15) next »