CVS update: php3/doc/functions

From: Date: Thu, 10 Dec 1998 02:07:43 +0000
Subject: CVS update: php3/doc/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2731@lists.php.net to get a copy of this message
Date: Wednesday December 9, 1998 @ 21:07 Author: jim Update of /repository/php3/doc/functions In directory asf:/u/temp/cvs-serv5033/functions Modified Files: array.sgml datetime.sgml dir.sgml filesystem.sgml http.sgml image.sgml ldap.sgml mail.sgml misc.sgml msql.sgml mysql.sgml network.sgml pgsql.sgml regex.sgml strings.sgml uodbc.sgml url.sgml var.sgml Log Message: More revisions from the errata. Index: php3/doc/functions/array.sgml diff -c php3/doc/functions/array.sgml:1.29 php3/doc/functions/array.sgml:1.30 *** php3/doc/functions/array.sgml:1.29 Mon Dec 7 22:12:29 1998 --- php3/doc/functions/array.sgml Wed Dec 9 21:07:36 1998 *************** *** 561,573 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef><function>reset</function></funcdef> <paramdef>array <parameter>array</parameter></paramdef> </funcsynopsis> <para> <function>reset</function> rewinds <parameter>array</parameter>'s internal pointer to the first element. <para> See also: <function>current</function>, <function>each</function>, <function>next</function> <function>prev</function> and <function>reset</function> --- 561,576 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>mixed <function>reset</function></funcdef> <paramdef>array <parameter>array</parameter></paramdef> </funcsynopsis> <para> <function>reset</function> rewinds <parameter>array</parameter>'s internal pointer to the first element. <para> + <function>reset</function> returns the value of the first array + element. + <para> See also: <function>current</function>, <function>each</function>, <function>next</function> <function>prev</function> and <function>reset</function> *************** *** 592,599 **** <programlisting> $fruits = array("lemon","orange","banana","apple"); rsort($fruits); ! for(reset($fruits); $key = key($fruits); next($fruits)) { ! echo "fruits[$key] = ".$fruits[$key]."\n"; } </programlisting></example> This example would display: --- 595,602 ---- <programlisting> $fruits = array("lemon","orange","banana","apple"); rsort($fruits); ! for(reset($fruits); ($key,$value) = each($fruits); ) { ! echo "fruits[$key] = ".$value."\n"; } </programlisting></example> This example would display: Index: php3/doc/functions/datetime.sgml diff -c php3/doc/functions/datetime.sgml:1.21 php3/doc/functions/datetime.sgml:1.22 *** php3/doc/functions/datetime.sgml:1.21 Mon Dec 7 22:12:29 1998 --- php3/doc/functions/datetime.sgml Wed Dec 9 21:07:36 1998 *************** *** 331,337 **** </funcsynopsis> <para> Returns the current time measured in the number of seconds since ! the Unix Epoch (January 1, 1970). </para><para> See also <function>date</function>. </para> --- 331,337 ---- </funcsynopsis> <para> Returns the current time measured in the number of seconds since ! the Unix Epoch (January 1 1970 00:00:00 GMT). </para><para> See also <function>date</function>. </para> Index: php3/doc/functions/dir.sgml diff -c php3/doc/functions/dir.sgml:1.10 php3/doc/functions/dir.sgml:1.11 *** php3/doc/functions/dir.sgml:1.10 Sun Mar 29 15:13:14 1998 --- php3/doc/functions/dir.sgml Wed Dec 9 21:07:36 1998 *************** *** 105,112 **** <funcdef>string <function>readdir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcsynopsis> ! <para> Returns the filename of the next file from the directory. The ! filenames are not returned in any particular order.</para> </refsect1> </refentry> --- 105,126 ---- <funcdef>string <function>readdir</function></funcdef> <paramdef>int <parameter>dir_handle</parameter></paramdef> </funcsynopsis> ! <para> ! Returns the filename of the next file from the directory. The ! filenames are not returned in any particular order. ! <example><title>List all files in the current directory</title> ! <programlisting> ! &lt;?php ! $handle=opendir('.'); ! echo "Directory handle: $handle\n"; ! echo "Files:\n"; ! while ($file = readdir($handle)) { ! echo "$file\n"; ! } ! closedir($handle); ! ?> ! </programlisting> ! </example> </refsect1> </refentry> Index: php3/doc/functions/filesystem.sgml diff -c php3/doc/functions/filesystem.sgml:1.31 php3/doc/functions/filesystem.sgml:1.32 *** php3/doc/functions/filesystem.sgml:1.31 Mon Dec 7 22:12:29 1998 --- php3/doc/functions/filesystem.sgml Wed Dec 9 21:07:36 1998 *************** *** 1061,1066 **** --- 1061,1073 ---- </funcsynopsis> <para> Attempts to create the directory specified by pathname. + + <para> + Note that you probably want to specify the mode as an + octal number, which means it should have a leading zero. + <informalexample><programlisting> + mkdir("/path/to/my/dir", 0700); + </programlisting></informalexample> <para> Returns true on success and false on failure. *************** *** 1142,1167 **** <funcdef>int <function>readfile</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcsynopsis> ! <para> Reads a file and writes it to standard output. ! <para> Returns the number of bytes read from the file. If an error occurs, false is returned and unless the function was called as @readfile, an error message is printed. ! <para> If <parameter>filename</parameter> begins with "http://" (not case sensitive), an HTTP 1.0 connection is opened to the specified server and the text of the response is written to standard output. ! <para> Does not handle HTTP redirects, so you must include trailing slashes on directories. ! <para> If <parameter>filename</parameter> begins with "ftp://" (not case sensitive), an ftp connection to the specified server is opened and the requested file is written to standard output. If the server does not support passive mode ftp, this will fail. ! <para> If <parameter>filename</parameter> begins with neither of these strings, the file will be opened from the filesystem and its contents written to standard output. <para> See also <function>fpassthru</function>, <function>file</function>, ! and <function>fopen</function>. </refsect1> </refentry> --- 1149,1181 ---- <funcdef>int <function>readfile</function></funcdef> <paramdef>string <parameter>filename</parameter></paramdef> </funcsynopsis> ! <para> ! Reads a file and writes it to standard output. ! <para> ! Returns the number of bytes read from the file. If an error occurs, false is returned and unless the function was called as @readfile, an error message is printed. ! <para> ! If <parameter>filename</parameter> begins with "http://" (not case sensitive), an HTTP 1.0 connection is opened to the specified server and the text of the response is written to standard output. ! <para> ! Does not handle HTTP redirects, so you must include trailing slashes on directories. ! <para> ! If <parameter>filename</parameter> begins with "ftp://" (not case sensitive), an ftp connection to the specified server is opened and the requested file is written to standard output. If the server does not support passive mode ftp, this will fail. ! <para> ! If <parameter>filename</parameter> begins with neither of these strings, the file will be opened from the filesystem and its contents written to standard output. <para> See also <function>fpassthru</function>, <function>file</function>, ! <function>fopen</function>, <function>include</function>, ! <function>require</function>, and <function>virtual</function>. </refsect1> </refentry> *************** *** 1341,1347 **** <paramdef>string <parameter>link</parameter></paramdef> </funcsynopsis> <para> ! <function>Symlink</function> creates a symbolic link. <para> See also <function>link</function> to create hard links, and <function>readlink</function> along with --- 1355,1363 ---- <paramdef>string <parameter>link</parameter></paramdef> </funcsynopsis> <para> ! <function>symlink</function> creates a symbolic link ! from the existing <parameter>target</parameter> with ! the specified name <parameter>link</parameter>. <para> See also <function>link</function> to create hard links, and <function>readlink</function> along with *************** *** 1363,1369 **** <paramdef>string <parameter>prefix</parameter></paramdef> </funcsynopsis> <para> ! Creates a unique temporary filename. <para> Returns the new temporary filename, or the null string on --- 1379,1387 ---- <paramdef>string <parameter>prefix</parameter></paramdef> </funcsynopsis> <para> ! Creates a unique temporary filename in the specified directory. ! If the directory does not exist, <function>tempnam</function> ! may generate a filename in the system's temporary directory. <para> Returns the new temporary filename, or the null string on Index: php3/doc/functions/http.sgml diff -c php3/doc/functions/http.sgml:1.10 php3/doc/functions/http.sgml:1.11 *** php3/doc/functions/http.sgml:1.10 Mon Dec 7 22:12:31 1998 --- php3/doc/functions/http.sgml Wed Dec 9 21:07:38 1998 *************** *** 95,101 **** Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same ! name as the cookie name. ie. to see the contents of our test cookie in a script, simply do: <informalexample><programlisting role=php> echo $TestCookie; --- 95,101 ---- Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same ! name as the cookie name. To see the contents of our test cookie in a script, simply do: <informalexample><programlisting role=php> echo $TestCookie; Index: php3/doc/functions/image.sgml diff -c php3/doc/functions/image.sgml:1.20 php3/doc/functions/image.sgml:1.21 *** php3/doc/functions/image.sgml:1.20 Wed Nov 4 03:14:03 1998 --- php3/doc/functions/image.sgml Wed Dec 9 21:07:38 1998 *************** *** 117,126 **** <paramdef>int <parameter>col</parameter></paramdef> </funcsynopsis> <para> ! ImageChar draws the first character of c in the image identified ! by id at coordinates x, y (top left is 0,0) with the color col. ! If font is 1, 2, 3, 4 or 5, a built-in font is used. ! <para> See also <function>imageloadfont</function>. --- 117,127 ---- <paramdef>int <parameter>col</parameter></paramdef> </funcsynopsis> <para> ! ImageChar draws the first character of <parameter>c</parameter> in the image ! identified by <parameter>id</parameter> with its upper-left at ! <parameter>x</parameter>,<parameter>y</parameter> (top left is 0,0) with the ! color <parameter>col</parameter>. If font is 1, 2, 3, 4 or 5, a built-in font is ! used (with higher numbers corresponding to larger fonts). <para> See also <function>imageloadfont</function>. *************** *** 165,175 **** <paramdef>int <parameter>green</parameter></paramdef> <paramdef>int <parameter>blue</parameter></paramdef> </funcsynopsis> ! <para> ImageColorAllocate returns a color identifier representing the ! color composed of the given RGB components. The im ! argument is the return from the <function>imagecreate</function> ! function. ImageColorAllocate must be called to create each color ! that is to be used in the image represented by im. </refsect1> </refentry> --- 166,180 ---- <paramdef>int <parameter>green</parameter></paramdef> <paramdef>int <parameter>blue</parameter></paramdef> </funcsynopsis> ! <para> ! ImageColorAllocate returns a color identifier representing the color composed of ! the given RGB components. The im argument is the return from the ! <function>imagecreate</function> function. ImageColorAllocate must be called to ! create each color that is to be used in the image represented by im. ! <informalexample><programlisting> ! $white = ImageColorAllocate($im, 255,255,255); ! $black = ImageColorAllocate($im, 0,0,0); ! </programlisting></informalexample> </refsect1> </refentry> *************** *** 401,408 **** <funcdef>int <function>imagefontheight</function></funcdef> <paramdef>int <parameter>font</parameter></paramdef> </funcsynopsis> ! <para> Returns the pixel width of a character in font. ! <para> See also <function>imagefontwidth</function> and <function>imageloadfont</function>. </refsect1> </refentry> --- 406,416 ---- <funcdef>int <function>imagefontheight</function></funcdef> <paramdef>int <parameter>font</parameter></paramdef> </funcsynopsis> ! <para> ! Returns the pixel height of a character in the specified font. ! <para> ! See also <function>imagefontwidth</function> and ! <function>imageloadfont</function>. </refsect1> </refentry> *************** *** 878,884 **** </programlisting></example> <para> ! This function requires both the GD library and the Freetype library. <para> See also <function>ImageTTFBBox</function>. </refsect1> --- 886,893 ---- </programlisting></example> <para> ! This function requires both the GD library and the <ulink ! url="http://www.freetype.org/">FreeType</ulink< library. <para> See also <function>ImageTTFBBox</function>. </refsect1> Index: php3/doc/functions/ldap.sgml diff -c php3/doc/functions/ldap.sgml:1.24 php3/doc/functions/ldap.sgml:1.25 *** php3/doc/functions/ldap.sgml:1.24 Sun Nov 29 05:19:08 1998 --- php3/doc/functions/ldap.sgml Wed Dec 9 21:07:38 1998 *************** *** 934,940 **** <para> The search filter can be simple or advanced, using boolean operators in the format described in the LDAP doumentation (see ! the Netscape Directory SDK for full information on filters). <para> The example below retrieves the organizational unit, surname, given name and email address for all people in "My Company" where --- 934,941 ---- <para> The search filter can be simple or advanced, using boolean operators in the format described in the LDAP doumentation (see ! the <ulink url="&url.ldap.netscape;">Netscape Directory SDK</ulink> ! for full information on filters). <para> The example below retrieves the organizational unit, surname, given name and email address for all people in "My Company" where Index: php3/doc/functions/mail.sgml diff -c php3/doc/functions/mail.sgml:1.6 php3/doc/functions/mail.sgml:1.7 *** php3/doc/functions/mail.sgml:1.6 Mon Nov 16 05:30:31 1998 --- php3/doc/functions/mail.sgml Wed Dec 9 21:07:39 1998 *************** *** 15,21 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>void <function>mail</function></funcdef> <paramdef>string <parameter>to</parameter></paramdef> <paramdef>string <parameter>subject</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> --- 15,21 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>bool <function>mail</function></funcdef> <paramdef>string <parameter>to</parameter></paramdef> <paramdef>string <parameter>subject</parameter></paramdef> <paramdef>string <parameter>message</parameter></paramdef> *************** *** 42,48 **** <title>Sending mail with extra headers.</title> <programlisting> mail("ssb@guardian.no", "the subject", $message, ! "From: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); </programlisting> </example> </refsect1> --- 42,48 ---- <title>Sending mail with extra headers.</title> <programlisting> mail("ssb@guardian.no", "the subject", $message, ! "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); </programlisting> </example> </refsect1> Index: php3/doc/functions/misc.sgml diff -c php3/doc/functions/misc.sgml:1.14 php3/doc/functions/misc.sgml:1.15 *** php3/doc/functions/misc.sgml:1.14 Mon Dec 7 22:12:31 1998 --- php3/doc/functions/misc.sgml Wed Dec 9 21:07:39 1998 *************** *** 418,428 **** <paramdef>string <parameter>prefix</parameter></paramdef> </funcsynopsis> <simpara> ! <function>Uniqid</function> returns a prefixed unique identifier based on current time in microseconds. The prefix can be useful for instance if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond. The prefix can be up to 114 characters long. </refsect1> </refentry> --- 418,439 ---- <paramdef>string <parameter>prefix</parameter></paramdef> </funcsynopsis> <simpara> ! <function>uniqid</function> returns a prefixed unique identifier based on current time in microseconds. The prefix can be useful for instance if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond. The prefix can be up to 114 characters long. + <para> + If you need a unique identifier or token and you intend to give + out that token to the user via the network (i.e. session cookies), + it is recommended that you use something along the lines of + <informalexample><programlisting> + $token = md5(uniqid("")); // no random portion + $better_token = md5(uniqid(random())); // better, difficult to guess + </programlisting></informalexample> + <simpara> + This will create a 32 character identifier (a 128 bit hex number) + that is extremely difficult to predict. </refsect1> </refentry> Index: php3/doc/functions/msql.sgml diff -c php3/doc/functions/msql.sgml:1.19 php3/doc/functions/msql.sgml:1.20 *** php3/doc/functions/msql.sgml:1.19 Tue Oct 27 15:12:48 1998 --- php3/doc/functions/msql.sgml Wed Dec 9 21:07:39 1998 *************** *** 259,264 **** --- 259,268 ---- <function>msql_fetch_row</function>. In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. + <para> + Be careful if you are retrieving results from a query that may + return a record that contains only one field that has a value + of 0 (or an empty string, or NULL). <para> An important thing to note is that using msql_fetch_array() is NOT significantly slower than using Index: php3/doc/functions/mysql.sgml diff -c php3/doc/functions/mysql.sgml:1.18 php3/doc/functions/mysql.sgml:1.19 *** php3/doc/functions/mysql.sgml:1.18 Mon Dec 7 22:12:31 1998 --- php3/doc/functions/mysql.sgml Wed Dec 9 21:07:39 1998 *************** *** 22,35 **** <paramdef>int <parameter><optional>link_identifier</optional> </parameter></paramdef> </funcsynopsis> - <para> - Returns: The number of affected rows by the last query. <para> <function>mysql_affected_rows</function> returns the number of rows affected by the last INSERT, UPDATE or DELETE query on the server associated with the specified link identifier. If the link identifier isn't specified, the last opened link is assumed. <para> This command is not effective for SELECT statements, only on statements which modify records. To retrieve the number of rows returned from a SELECT, use <function>mysql_num_rows</function>. --- 22,37 ---- <paramdef>int <parameter><optional>link_identifier</optional> </parameter></paramdef> </funcsynopsis> <para> <function>mysql_affected_rows</function> returns the number of rows affected by the last INSERT, UPDATE or DELETE query on the server associated with the specified link identifier. If the link identifier isn't specified, the last opened link is assumed. <para> + If the last query was a DELETE query with no WHERE clause, all + of the records will have been deleted from the table but this + function will return zero. + <para> This command is not effective for SELECT statements, only on statements which modify records. To retrieve the number of rows returned from a SELECT, use <function>mysql_num_rows</function>. *************** *** 313,319 **** <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_errno</function></funcdef> ! <paramdef><parameter></parameter></paramdef> </funcsynopsis> <para> Errors coming back from the mySQL database backend no longer --- 315,322 ---- <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_errno</function></funcdef> ! <paramdef>int <parameter><optional>link_identifier</optional> ! </parameter></paramdef> </funcsynopsis> <para> Errors coming back from the mySQL database backend no longer *************** *** 347,353 **** <title>Description</title> <funcsynopsis> <funcdef>string <function>mysql_error</function></funcdef> ! <paramdef><parameter></parameter></paramdef> </funcsynopsis> <para> Errors coming back from the mySQL database backend no longer --- 350,357 ---- <title>Description</title> <funcsynopsis> <funcdef>string <function>mysql_error</function></funcdef> ! <paramdef>int <parameter><optional>link_identifier</optional> ! </parameter></paramdef> </funcsynopsis> <para> Errors coming back from the mySQL database backend no longer *************** *** 384,390 **** <paramdef>int <parameter>result</parameter></paramdef> </funcsynopsis> <para> ! Returns: An array that corresponds to the fetched row, or false if there are no more rows. <para> <function>mysql_fetch_array</function> is an extended version of --- 388,394 ---- <paramdef>int <parameter>result</parameter></paramdef> </funcsynopsis> <para> ! Returns an array that corresponds to the fetched row, or false if there are no more rows. <para> <function>mysql_fetch_array</function> is an extended version of *************** *** 392,397 **** --- 396,409 ---- data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. <para> + If two or more columns of the result have the same field names, + the last column will take precedence. To access the other column(s) + of the same name, you must the numeric index of the column or + make an alias for the column. + <informalexample><programlisting> + select t1.f1 as foo t2.f1 as bar from t1, t2 + </programlisting></informalexample> + <para> An important thing to note is that using <function>mysql_fetch_array</function> is NOT significantly slower than using <function>mysql_fetch_row</function>, while it *************** *** 523,529 **** <paramdef>int <parameter>result</parameter></paramdef> </funcsynopsis> <para> ! Returns: An object with properties that correspond to the fetched row, or false if there are no more rows. <para> <function>mysql_fetch_object</function> is similar to --- 535,541 ---- <paramdef>int <parameter>result</parameter></paramdef> </funcsynopsis> <para> ! Returns an object with properties that correspond to the fetched row, or false if there are no more rows. <para> <function>mysql_fetch_object</function> is similar to *************** *** 536,541 **** --- 548,568 ---- <function>mysql_fetch_array</function>, and almost as quick as <function>mysql_fetch_row</function> (the difference is insignificant). + <example> + <title>mysql fetch object</title> + <programlisting role=php> + &lt;?php + mysql_connect($host,$user,$password); + $result = mysql_db_query("database","select * from table"); + while($row = mysql_fetch_object($result)) { + echo $row->user_id; + echo $row->fullname; + } + mysql_free_result($result); + ?> + </programlisting> + </example> + <para> See also: <function>mysql_fetch_array</function> and <function>mysql_fetch_row</function>. </refsect1> *************** *** 697,703 **** <function>mysql_field_type</function> is similar to the <function>mysql_field_name</function> function. The arguments are identical, but the field type is returned. This will be one of ! "int", "real", "string", or "blob". <example> <title>mysql field types</title> --- 724,731 ---- <function>mysql_field_type</function> is similar to the <function>mysql_field_name</function> function. The arguments are identical, but the field type is returned. This will be one of ! "int", "real", "string", "blob", or others as detailed in the ! MySQL documentation. <example> <title>mysql field types</title> *************** *** 925,931 **** <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_insert_id</function></funcdef> ! <void> </funcsynopsis> <para> <function>mysql_insert_id</function> returns the ID generated for --- 953,959 ---- <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_insert_id</function></funcdef> ! <paramdef>int <parameter><optional>link_identifier</optional></parameter></paramdef> </funcsynopsis> <para> <function>mysql_insert_id</function> returns the ID generated for *************** *** 1148,1154 **** <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_num_rows</function></funcdef> ! <paramdef>string <parameter>result</parameter></paramdef> </funcsynopsis> <para> <function>mysql_num_rows</function> returns the number of rows in --- 1176,1182 ---- <title>Description</title> <funcsynopsis> <funcdef>int <function>mysql_num_rows</function></funcdef> ! <paramdef>int <parameter>result</parameter></paramdef> </funcsynopsis> <para> <function>mysql_num_rows</function> returns the number of rows in *************** *** 1241,1256 **** </parameter></paramdef> </funcsynopsis> <para> - Returns: A positive MySQL result identifier on success, or false - on error. - <para> <function>mysql_query</function> sends a query to the currently active database on the server that's associated with the ! specified link identifier. If the link identifier isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if <function>mysql_connect</function> was called, and use it. <para> See also: <function>mysql_db_query</function>, <function>mysql_select_db</function>, and --- 1269,1286 ---- </parameter></paramdef> </funcsynopsis> <para> <function>mysql_query</function> sends a query to the currently active database on the server that's associated with the ! specified link identifier. If <parameter>link_identifier</parameter> isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if <function>mysql_connect</function> was called, and use it. <para> + This function returns TRUE or FALSE to indicate the success of + UPDATE, INSERT, and DELETE queries. For SELECT queries it returns + a new result identifier. The resources used by the query can + then be freed by calling <function>mysql_free_result</function>. + <para> See also: <function>mysql_db_query</function>, <function>mysql_select_db</function>, and *************** *** 1271,1279 **** <paramdef>int <parameter>row</parameter></paramdef> <paramdef>mixed <parameter>field</parameter></paramdef> </funcsynopsis> - <para> - Returns: The contents of the cell at the row and offset in the - specified MySQL result set. <para> <function>mysql_result</function> returns the contents of one cell from a MySQL result set. The field argument can be the --- 1301,1306 ---- *************** *** 1289,1294 **** --- 1316,1324 ---- <function>mysql_result</function>. Also, note that specifying a numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument. + <para> + Calls <function>mysql_result</function> should not be mixed + with calls to other functions that deal with the result set. <para> Recommended high-performance alternatives: <function>mysql_fetch_row</function>, Index: php3/doc/functions/network.sgml diff -c php3/doc/functions/network.sgml:1.18 php3/doc/functions/network.sgml:1.19 *** php3/doc/functions/network.sgml:1.18 Mon Nov 9 08:41:57 1998 --- php3/doc/functions/network.sgml Wed Dec 9 21:07:41 1998 *************** *** 282,287 **** --- 282,293 ---- two characters <literal>%m</literal> will be replaced by the error message string (strerror) corresponding to the present value of <errortype>errno</errortype>. + <para> + More information on the syslog facilities can be found in + the man pages for syslog on Unix machines. + <para> + On Windows NT, the syslog service is emulated using the + Event Log. </refsect1> </refentry> Index: php3/doc/functions/pgsql.sgml diff -c php3/doc/functions/pgsql.sgml:1.30 php3/doc/functions/pgsql.sgml:1.31 *** php3/doc/functions/pgsql.sgml:1.30 Sat Sep 19 17:46:08 1998 --- php3/doc/functions/pgsql.sgml Wed Dec 9 21:07:41 1998 *************** *** 99,105 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>void <function>pg_close</function></funcdef> <paramdef>int <parameter>connection</parameter></paramdef> </funcsynopsis> <para> --- 99,105 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>bool <function>pg_close</function></funcdef> <paramdef>int <parameter>connection</parameter></paramdef> </funcsynopsis> <para> Index: php3/doc/functions/regex.sgml diff -c php3/doc/functions/regex.sgml:1.10 php3/doc/functions/regex.sgml:1.11 *** php3/doc/functions/regex.sgml:1.10 Mon Sep 7 08:09:09 1998 --- php3/doc/functions/regex.sgml Wed Dec 9 21:07:41 1998 *************** *** 175,180 **** --- 175,184 ---- <programlisting> $passwd_list = split( ":", $passwd_line, 5 ); </programlisting></example> + <para> + Note that <parameter>pattern</parameter> is case-sensitive. + <para> + See also: <function>explode</function> and <function>implode</function>. </refsect1> </refentry> Index: php3/doc/functions/strings.sgml diff -c php3/doc/functions/strings.sgml:1.44 php3/doc/functions/strings.sgml:1.45 *** php3/doc/functions/strings.sgml:1.44 Mon Dec 7 22:12:32 1998 --- php3/doc/functions/strings.sgml Wed Dec 9 21:07:41 1998 *************** *** 267,272 **** --- 267,277 ---- meanings. This function returns a string with these conversions made. + <simpara> + This function is useful in preventing user-supplied text from + containing HTML markup, such as in a message board or + guest book application. + <para> At present, the translations that are done are: <itemizedlist> *************** *** 287,293 **** <para> Note that this functions does not translate anything beyond what is listed above. For full entity translation, see <function>htmlentities</function>. ! <para> See also <function>htmlentities</function> and <function>nl2br</function>. --- 292,298 ---- <para> Note that this functions does not translate anything beyond what is listed above. For full entity translation, see <function>htmlentities</function>. ! <para> See also <function>htmlentities</function> and <function>nl2br</function>. *************** *** 403,409 **** <para> Calculates the MD5 hash of <parameter>str</parameter> using the ! RSA Data Security, Inc. MD5 Message-Digest Algorithm. </refsect1> </refentry> --- 408,415 ---- <para> Calculates the MD5 hash of <parameter>str</parameter> using the ! <ulink url="http://ds.internic.net/rfc/rfc1321.txt">RSA Data ! Security, Inc. MD5 Message-Digest Algorithm</ulink>. </refsect1> </refentry> *************** *** 576,583 **** <simpara> See also <function>addslashes</function>, <function>htmlentities</function>, ! <function>htmlspecialchars</function>, and ! <function>nl2br</function>. </refsect1> </refentry> --- 582,590 ---- <simpara> See also <function>addslashes</function>, <function>htmlentities</function>, ! <function>htmlspecialchars</function>, ! <function>nl2br</function>, and ! <function>stripslashes</function>. </refsect1> </refentry> *************** *** 871,876 **** --- 878,894 ---- $isodate = sprintf("%04d-%02d-%02d", $year, $month, $day); </programlisting></example> + <example> + <title>sprintf: formatting currency</title> + <programlisting> + $money1 = 68.75; + $money2 = 54.35; + $money = $money1 + $money2; + // echo $money will output "123.1"; + $formatted = sprintf ("%01.2f", $money); + // echo $formatted will output "123.10" + </programlisting></example> + </para> </refsect1> </refentry> *************** *** 992,998 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>string <function>strrpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>char <parameter>needle</parameter></paramdef> </funcsynopsis> --- 1010,1016 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>int <function>strrpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>char <parameter>needle</parameter></paramdef> </funcsynopsis> *************** *** 1025,1031 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>string <function>strpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>int <parameter><optional>offset</optional></parameter></paramdef> --- 1043,1049 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>int <function>strpos</function></funcdef> <paramdef>string <parameter>haystack</parameter></paramdef> <paramdef>string <parameter>needle</parameter></paramdef> <paramdef>int <parameter><optional>offset</optional></parameter></paramdef> *************** *** 1079,1088 **** Returns false if <parameter>needle</parameter> is not found. <para> - If <parameter>needle</parameter> is not found, false is - returned. - - <para> If <parameter>needle</parameter> contains more than one character, the first is used. --- 1097,1102 ---- *************** *** 1193,1199 **** <paramdef>string <parameter>arg2</parameter></paramdef> </funcsynopsis> <para> ! strtok() is used to tokenize a string. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. --- 1207,1213 ---- <paramdef>string <parameter>arg2</parameter></paramdef> </funcsynopsis> <para> ! <function>strtok</function> is used to tokenize a string. That is, if you have a string like "This is an example string" you could tokenize this string into its individual words by using the space character as the token. *************** *** 1219,1224 **** --- 1233,1242 ---- found. <para> + Also be careful that your tokens may be equal to "0". This + evaluates to false in conditional expressions. + + <para> See also <function>split</function> and <function>explode</function>. *************** *** 1363,1369 **** If <parameter>length</parameter> is given and is positive, the string returned will end <parameter>length</parameter> characters from <parameter>start</parameter>. If this would ! result in a string with negative length, then the returned string will contain the single character at <parameter>start</parameter>. <para> --- 1381,1388 ---- If <parameter>length</parameter> is given and is positive, the string returned will end <parameter>length</parameter> characters from <parameter>start</parameter>. If this would ! result in a string with negative length (because the start ! is past the end of the string), then the returned string will contain the single character at <parameter>start</parameter>. <para> Index: php3/doc/functions/uodbc.sgml diff -c php3/doc/functions/uodbc.sgml:1.17 php3/doc/functions/uodbc.sgml:1.18 *** php3/doc/functions/uodbc.sgml:1.17 Fri Nov 27 09:57:02 1998 --- php3/doc/functions/uodbc.sgml Wed Dec 9 21:07:42 1998 *************** *** 403,409 **** </refsect1> </refentry> ! <refentry id="function.odbc-field-num"> <refnamediv> <refname>odbc_field_num</refname> --- 403,409 ---- </refsect1> </refentry> ! <!-- <refentry id="function.odbc-field-num"> <refnamediv> <refname>odbc_field_num</refname> *************** *** 412,418 **** <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>int <function>odbc_fieldnum</function></funcdef> <paramdef>int <parameter>result_id</parameter></paramdef> <paramdef>string <parameter>field_name</parameter></paramdef> </funcsynopsis> --- 412,418 ---- <refsect1> <title>Description</title> <funcsynopsis> ! <funcdef>int <function>odbc_field_num</function></funcdef> <paramdef>int <parameter>result_id</parameter></paramdef> <paramdef>string <parameter>field_name</parameter></paramdef> </funcsynopsis> *************** *** 424,430 **** </refsect1> </refentry> ! <refentry id="function.odbc-field-type"> <refnamediv> --- 424,430 ---- </refsect1> </refentry> ! --> <refentry id="function.odbc-field-type"> <refnamediv> *************** *** 638,646 **** --- 638,667 ---- <para> Returns the contents of the field. <para> + <parameter>field</parameter> can either be an integer containing + the column number of the field you want; or it can be a string + containing the name of the field. For example: + <informalexample><programlisting> + $item_3 = odbc_result($Query_ID, 3 ); + $item_val = odbc_result($Query_ID, "val"); + </programlisting></informalexample> + <para> + The first call to <function>odbc_result</function> returns the + value of the third field in the current record of the query + result. The second function call to + <function>odbc_result</function> returns the value of the field + whose field name is "val" in the current record of the query + result. An error occurs if a column number parameter for a field + is less than one or exceeds the number of columns (or fields) in + the current record. Similarly, an error occurs if a field with a + name that is not one of the fieldnames of the table(s) that + is(are) being queried. + + <para> Field indices start from 1. Regarding the way binary or long column data is returned refer to <function>odbc_binmode </function> and <function>odbc_longreadlen</function>. + <!-- If the requested field contains Index: php3/doc/functions/url.sgml diff -c php3/doc/functions/url.sgml:1.9 php3/doc/functions/url.sgml:1.10 *** php3/doc/functions/url.sgml:1.9 Sun Nov 1 17:02:12 1998 --- php3/doc/functions/url.sgml Wed Dec 9 21:07:42 1998 *************** *** 14,23 **** <funcdef>array <function>parse_url</function></funcdef> <paramdef>string <parameter>url</parameter></paramdef> </funcsynopsis> ! <para>Returns: This function returns an associative array returning any of the various ! components of the URL that are present. This includes the "scheme", "host", ! "port", "user", "pass", "path", "query", and "fragment". ! </para> </refsect1> </refentry> --- 14,24 ---- <funcdef>array <function>parse_url</function></funcdef> <paramdef>string <parameter>url</parameter></paramdef> </funcsynopsis> ! <para> ! This function returns an associative array returning any of the ! various components of the URL that are present. This includes the ! "scheme", "host", "port", "user", "pass", "path", "query", and ! "fragment". </refsect1> </refentry> Index: php3/doc/functions/var.sgml diff -c php3/doc/functions/var.sgml:1.11 php3/doc/functions/var.sgml:1.12 *** php3/doc/functions/var.sgml:1.11 Mon Dec 7 22:12:34 1998 --- php3/doc/functions/var.sgml Wed Dec 9 21:07:42 1998 *************** *** 400,405 **** --- 400,415 ---- Returns true if <parameter>var</parameter> exists; false otherwise. + <para> + If a variable has been unset with <function>unset</function>, + it will no longer be <function>isset</function>. + <informalexample><programlisting> + $a = "test"; + echo isset($a); // true + unset($a); + echo isset($a); // false + </programlisting></informalexample> + <simpara> See also <function>empty</function> and <function>unset</function>. -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2731) next »