PHP Knowledge Base Update -- August 13th, 1999

From: Date: Sat, 14 Aug 1999 05:51:19 +0000
Subject: PHP Knowledge Base Update -- August 13th, 1999
Groups: php.kb 
Request: Send a blank email to php-kb+get-29@lists.php.net to get a copy of this message
Sorry to everyone (particularly Andy) on the php-kb mailing list for that rogue email that I sent yesterday. Doing too many things at once, I accidently accepted rather than rejected it. Clearly my multi-tasking capabilities aren't up to scratch...<g> Cheers, Nathan ------------------------------------------------------------ How can I have two submit buttons in the same HTML form? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/594 ------------------------------------------------------------ Manuel Lemos What you need to do is to set different names for each submit image button like this: <input type="image" name="type_1"> <input type="image" name="type_2"> Then to check if the form was submitted try: if(IsSet($type_1)) { echo "form was submitted with image button 1."; } else { if(IsSet($type_2)) { echo "form was submitted with image button 2."; } else { echo "form was not submitted with any image button."; } } ------------------------------------------------------------ What is a BLOB? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/595 ------------------------------------------------------------ Kristian Köhntopp A BLOB is a "Binary Large OBject" in a database. BLOBs are strange things for most databases for several reasons. Most of these reasons are related to the B in BLOBs: BLOBs can be very large, 2 GB or more, depending on the database. For example, BLOBs are typically larger than a single block of storage in your database, rendering many performance assumptions invalid that your database uses to make access to your data efficient. For example, if you have BLOBs in your table, the size of these BLOBs may vary wildly from a few bytes to hundreds of Kilobytes, making it very difficult for your DB engine to balance storage requirements evenly. Deleting BLOBs from a table will leave large holes in your database files, which will eventually get filled with data from totally different storage locations, leading to a wildly fragmented storage order on disk for your data. Because BLOBs have potential to be very large and can vary so wildly in size, BLObs can usually not be indexed. Search operations on BLOBs are therefore slow compared to small types. Also, BLOBs are usually so large that you do not want to retrieve them in many cases. That is, the database has to have a special API with which you can return a query result containing "BLOB handles" and then whole or partical BLOBs using these handles. This requires of course special BLOB code in your application, dealing with this special case. Because BLOBs are untyped data, and because of their size, BLOBs often hold compond data and the nature of that data is opaque to the database. That is, you may decide to store for example word documents, tiff images or other high level storage formats as BLOBs in your database. You cannot formulate high level search criteria on this data, because of the opaque nature of the storage. Your database cannot perform search operations like "find me all word documents which contain form fields named "city" where "city" is filled in as "kiel, germany". Also, you cannot search for all tiff images where an edge detection operator applied to the image finds horizontal lines. Some very advanced databases try to address the latter problem by offering you an API to write your own high level data types (sometimes called "cartridges" or "data blades") so that you may implement such operations. But in any case you can see that a BLOB is very different from a simple "large char" on the storage level, on the index level, from an API standpoint and from a high level abstract datatype view. ------------------------------------------------------------ How can I subscribe to the main PHP mailing list? How can I subscribe to the PHP Knowledge Base mailing list? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/596 ------------------------------------------------------------ Egon Schmid, Gianluca Baldo Try the HTML form at: http://www.php.net/support.php3 Subscribe by sending a blank message to: php3-subscribe@lists.php.net or for the knowledge base: php-kb-subscribe@lists.php.net ------------------------------------------------------------ Where can I find a PHP project that supports polls? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/598 ------------------------------------------------------------ Michael Waples, Sean 'Malby' Malloy Try: http://www.phpwizard.net/phpPolls/ or for one that doesn't need a database: http://www.quake-au.net/php/ ------------------------------------------------------------ How can I loop over the values in an array? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/599 ------------------------------------------------------------ Adam Trachtenberg Try code like this: $loop = array('first', 'second', 'tenth'); while (list($key,$value) = each($loop)) { echo $value; } ** OTHER RANDOMLY SELECTED PHPKB ENTRIES ** ------------------------------------------------------------ Why doesn't my PHP shell script work? Why will only print and echo work in my shell script? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/471 ------------------------------------------------------------ You may have forgotten the #!/path/to/php.binary at the top... Mainly because echo "some text" is valid shell script, but the other stuff isn't... Also check that you are using the CGI Version of PHP3. If you are, then you should be able to execute any PHP3 Script (minus ones with functions that are apache-specific like the virtural(); function) as-is without a problem... i.e. myshellscript.php3 #!/usr/bin/php3 -q <?php // my code ?> ------------------------------------------------------------ Why does PHP only run in a DOS window? I am using php3 and PWS version iv. When I double click on a .php3 file using win95 explorer, the correct html code scrolls and dos window closes. When I access the same script from an executable directory from internet explorer, the error message "No With php3 & PWS , after running php_iis_reg.inf, now I get "No input file specified". http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/547 ------------------------------------------------------------ Thanks for Help. I figured it out. In the php3.ini I had to add doc_root = c:\inetpub\wwwroot in the paths section. As Personal Web server version 4 uses a different default directory then PWS version 3. I suspect the default was pointing to the old directory. Thanks again. Steven Banks ------------------------------------------------------------ How do I setup the GD library with PHP to create dynamic graphics? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/138 ------------------------------------------------------------ If you use php on unix: you have to compile in support from gd in php. 1. get the source distribution of php and apache 2. get and install the GD library from http://www.boutell.com/gd/ 3. read the INSTALL file in the php source dir for instructions 4. make and install php/apache with gd support using : ./configure --with-gd[=DIR] (plus your other configure directives) Include GD support (DIR is GD's install dir). ------------------------------------------------------------ What are .afm files used for? Does t1lib use font metrics files? Do t1lib fonts use kerning information? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/337 ------------------------------------------------------------ It is very important to have .afm files for those PostScript fonts you are using (it's mentioned in t1lib's docs and everybody using this interface of PHP3 should really read those doc's too). Unless there are font metrics files the library can find, it must construct them itself. It takes some time (my testing says, between 1000-5000 more). And, if there is kerning information in that .afm file, it will be automagically used. In fact, there is no such option as 'turn kerning off'. ------------------------------------------------------------ Why is $PHP_SELF empty from a Netscape browser but not from IE? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/157 ------------------------------------------------------------ Using the line: <A HREF="<? echo $PHP_SELF; ?>?var=something">Link Name</a> you might get these links (as they appear in the View Source of the browser): URL in IE: http://myhost.com/phpfile.php3?var=something URL in Netscape: http://myhost.com/?var=something $PHP_SELF is probably empty in both cases. Netscape doesn't conform to RFC 2068 which says in "3.2.1 General Syntax" that URIs of the form ?query are valid. IE does handle these just fine and probably combines them to a correct URI while Netscape doesn't. You can echo $PHP_SELF somewhere in your document where it's not part of a link to check.

« previous php.kb (#29) next »