From 42c93b528036d8594f11c5a6a2f83cdebe648845 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Thu, 31 Mar 2005 07:47:25 +0000 Subject: [PATCH] Implemented new doc style, implemented new entities, and rewording where appropriate. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183245 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mysql/functions/mysql-affected-rows.xml | 9 +- .../mysql/functions/mysql-change-user.xml | 9 +- .../mysql/functions/mysql-client-encoding.xml | 9 +- reference/mysql/functions/mysql-close.xml | 9 +- reference/mysql/functions/mysql-connect.xml | 234 ++++++++++++------ reference/mysql/functions/mysql-create-db.xml | 13 +- reference/mysql/functions/mysql-data-seek.xml | 13 +- reference/mysql/functions/mysql-db-name.xml | 6 +- reference/mysql/functions/mysql-db-query.xml | 9 +- reference/mysql/functions/mysql-drop-db.xml | 13 +- reference/mysql/functions/mysql-errno.xml | 9 +- reference/mysql/functions/mysql-error.xml | 9 +- .../mysql/functions/mysql-fetch-array.xml | 11 +- .../mysql/functions/mysql-fetch-assoc.xml | 84 ++++--- .../mysql/functions/mysql-fetch-field.xml | 67 +++-- .../mysql/functions/mysql-fetch-lengths.xml | 47 +++- .../mysql/functions/mysql-fetch-object.xml | 126 ++++++---- reference/mysql/functions/mysql-fetch-row.xml | 62 +++-- .../mysql/functions/mysql-field-flags.xml | 52 +++- reference/mysql/functions/mysql-field-len.xml | 57 ++++- .../mysql/functions/mysql-field-name.xml | 68 ++--- .../mysql/functions/mysql-field-seek.xml | 30 ++- .../mysql/functions/mysql-field-table.xml | 58 +++-- .../mysql/functions/mysql-field-type.xml | 55 ++-- .../mysql/functions/mysql-free-result.xml | 49 +++- .../mysql/functions/mysql-get-client-info.xml | 36 ++- .../mysql/functions/mysql-get-host-info.xml | 53 ++-- .../mysql/functions/mysql-get-proto-info.xml | 51 ++-- .../mysql/functions/mysql-get-server-info.xml | 53 ++-- reference/mysql/functions/mysql-info.xml | 70 ++++-- reference/mysql/functions/mysql-insert-id.xml | 105 +++++--- reference/mysql/functions/mysql-list-dbs.xml | 70 ++++-- .../mysql/functions/mysql-list-fields.xml | 96 +++++-- .../mysql/functions/mysql-list-processes.xml | 46 +++- .../mysql/functions/mysql-list-tables.xml | 85 +++++-- .../mysql/functions/mysql-num-fields.xml | 61 +++-- reference/mysql/functions/mysql-num-rows.xml | 68 +++-- reference/mysql/functions/mysql-pconnect.xml | 167 ++++++++++--- reference/mysql/functions/mysql-ping.xml | 44 +++- reference/mysql/functions/mysql-query.xml | 21 +- .../functions/mysql-real-escape-string.xml | 135 +++++----- reference/mysql/functions/mysql-result.xml | 84 +++++-- reference/mysql/functions/mysql-select-db.xml | 77 ++++-- reference/mysql/functions/mysql-stat.xml | 11 +- reference/mysql/functions/mysql-tablename.xml | 82 +++++- reference/mysql/functions/mysql-thread-id.xml | 53 ++-- .../functions/mysql-unbuffered-query.xml | 57 ++++- 47 files changed, 1797 insertions(+), 836 deletions(-) diff --git a/reference/mysql/functions/mysql-affected-rows.xml b/reference/mysql/functions/mysql-affected-rows.xml index 9c417b867e..aa46d0f22b 100644 --- a/reference/mysql/functions/mysql-affected-rows.xml +++ b/reference/mysql/functions/mysql-affected-rows.xml @@ -1,5 +1,5 @@ - + mysql_affected_rows @@ -22,12 +22,7 @@ &reftitle.parameters; - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-change-user.xml b/reference/mysql/functions/mysql-change-user.xml index f68880f149..1ed7896f24 100644 --- a/reference/mysql/functions/mysql-change-user.xml +++ b/reference/mysql/functions/mysql-change-user.xml @@ -1,5 +1,5 @@ - + mysql_change_user @@ -57,12 +57,7 @@ - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-client-encoding.xml b/reference/mysql/functions/mysql-client-encoding.xml index 1afd5d2d02..55f2bdab65 100644 --- a/reference/mysql/functions/mysql-client-encoding.xml +++ b/reference/mysql/functions/mysql-client-encoding.xml @@ -1,5 +1,5 @@ - + mysql_client_encoding @@ -21,12 +21,7 @@ &reftitle.parameters; - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-close.xml b/reference/mysql/functions/mysql-close.xml index 494c12d1ff..09e1c4bd63 100644 --- a/reference/mysql/functions/mysql-close.xml +++ b/reference/mysql/functions/mysql-close.xml @@ -1,5 +1,5 @@ - + mysql_close @@ -31,12 +31,7 @@ &reftitle.parameters; - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-connect.xml b/reference/mysql/functions/mysql-connect.xml index 2e181510b5..a9c9d8ed9c 100644 --- a/reference/mysql/functions/mysql-connect.xml +++ b/reference/mysql/functions/mysql-connect.xml @@ -1,13 +1,13 @@ - - + mysql_connect Open a connection to a MySQL Server - - Description + + + &reftitle.description; resourcemysql_connect stringserver @@ -16,74 +16,131 @@ boolnew_link intclient_flags + + Opens or reuses a connection to a MySQL server. The link to the server will + be closed as soon as the execution of the script ends, unless it's closed + earlier by explicitly calling mysql_close. + + + + + &reftitle.parameters; + + + + server + + + The MySQL server. It can also include a port number. e.g. + "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for + the localhost. + + + If the PHP directive + mysql.default_host is undefined (default), then the default + value is 'localhost:3306' + + + + + username + + + The username. Default value is the name of the user that owns the + server process. + + + + + password + + + The password. Default value is an empty password. + + + + + new_link + + + If a second call is made to mysql_connect + with the same arguments, no new link will be established, but + instead, the link identifier of the already opened link will be + returned. The new_link parameter modifies this + behavior and makes mysql_connect always open + a new link, even if mysql_connect was called + before with the same parameters. + + + + + client_flags + + + The client_flags parameter can be a combination + of the following constants: + MYSQL_CLIENT_COMPRESS, + MYSQL_CLIENT_IGNORE_SPACE or + MYSQL_CLIENT_INTERACTIVE. + + + + + + + + + &reftitle.returnvalues; Returns a MySQL link identifier on success, or &false; on failure. + + + + &reftitle.changelog; - mysql_connect establishes a connection - to a MySQL server. The following defaults are assumed for - missing optional parameters: server = - 'localhost:3306', username = name of the - user that owns the server process and - password = empty password. - - - The server parameter can also include a port - number. e.g. "hostname:port" or a path to a local socket - e.g. ":/path/to/socket" for the localhost. - - - Whenever you specify "localhost" or - "localhost:port" as server, the MySQL client library will - override this and try to connect to a local socket (named pipe on - Windows). If you want to use TCP/IP, use "127.0.0.1" - instead of "localhost". If the MySQL client library tries to - connect to the wrong local socket, you should set the correct path as - mysql.default_host in your PHP configuration and leave the server field - blank. - - - Support for ":port" was added in PHP 3.0B4. - - - Support for ":/path/to/socket" was added in - PHP 3.0.10. - - - You can suppress the error message on failure by prepending - a @ - to the function name. - - - - - If a second call is made to mysql_connect - with the same arguments, no new link will be established, but - instead, the link identifier of the already opened link will be - returned. The new_link parameter modifies this - behavior and makes mysql_connect always open - a new link, even if mysql_connect was called - before with the same parameters. The client_flags - parameter can be a combination of the constants - MYSQL_CLIENT_COMPRESS, - MYSQL_CLIENT_IGNORE_SPACE or - MYSQL_CLIENT_INTERACTIVE. - - - - The new_link parameter became available - in PHP 4.2.0 - - - The client_flags parameter became available in - PHP 4.3.0 - - - - The link to the server will be closed as soon as the execution of - the script ends, unless it's closed earlier by explicitly calling - mysql_close. + + + + + &Version; + &Description; + + + + + 4.3.0 + + Added the client_flags parameter. + + + + 4.2.0 + + Added the new_link parameter. + + + + 3.0.10 + + Added support for ":/path/to/socket" with + server. + + + + 3.0.0 + + Added support for ":port" with server. + + + + + + + + + &reftitle.examples; <function>mysql_connect</function> example @@ -101,10 +158,45 @@ mysql_close($link); - - See also - mysql_pconnect and - mysql_close. + + + + &reftitle.notes; + + + Whenever you specify "localhost" or + "localhost:port" as server, the MySQL client library will + override this and try to connect to a local socket (named pipe on + Windows). If you want to use TCP/IP, use "127.0.0.1" + instead of "localhost". If the MySQL client library tries to + connect to the wrong local socket, you should set the correct path as + mysql.default_host in your PHP configuration and leave the server field + blank. + + + + + The link to the server will be closed as soon as the execution of + the script ends, unless it's closed earlier by explicitly calling + mysql_close. + + + + + You can suppress the error message on failure by prepending + a @ + to the function name. + + + + + + &reftitle.seealso; + + + mysql_pconnect + mysql_close + diff --git a/reference/mysql/functions/mysql-create-db.xml b/reference/mysql/functions/mysql-create-db.xml index 93e5f46fd6..55c62ebb5c 100644 --- a/reference/mysql/functions/mysql-create-db.xml +++ b/reference/mysql/functions/mysql-create-db.xml @@ -1,5 +1,5 @@ - + mysql_create_db @@ -30,12 +30,7 @@ - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; @@ -88,8 +83,8 @@ Database my_db created successfully &reftitle.notes; - For downwards compatibility mysql_createdb - can also be used. This is deprecated, however. + &info.deprecated.alias; + mysql_createdb diff --git a/reference/mysql/functions/mysql-data-seek.xml b/reference/mysql/functions/mysql-data-seek.xml index e8d62c6b13..ad00def4e9 100644 --- a/reference/mysql/functions/mysql-data-seek.xml +++ b/reference/mysql/functions/mysql-data-seek.xml @@ -1,5 +1,5 @@ - + mysql_data_seek @@ -9,7 +9,7 @@ &reftitle.description; boolmysql_data_seek - resourceresult_identifier + resourceresult introw_number @@ -32,14 +32,7 @@ &reftitle.parameters; - - result_identifier - - - The MySQL result identifier that is being seeked. - - - + &mysql.result.description; row_number diff --git a/reference/mysql/functions/mysql-db-name.xml b/reference/mysql/functions/mysql-db-name.xml index 3473d2634f..ba0045b4f7 100644 --- a/reference/mysql/functions/mysql-db-name.xml +++ b/reference/mysql/functions/mysql-db-name.xml @@ -1,5 +1,5 @@ - + mysql_db_name @@ -90,8 +90,8 @@ while ($i < $cnt) { &reftitle.notes; - For backward compatibility, mysql_dbname is - also accepted. This is deprecated, however. + &info.deprecated.alias; + mysql_dbname diff --git a/reference/mysql/functions/mysql-db-query.xml b/reference/mysql/functions/mysql-db-query.xml index b436472b64..5fb5191e2c 100644 --- a/reference/mysql/functions/mysql-db-query.xml +++ b/reference/mysql/functions/mysql-db-query.xml @@ -1,5 +1,5 @@ - + mysql_db_query @@ -40,12 +40,7 @@ - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-drop-db.xml b/reference/mysql/functions/mysql-drop-db.xml index 0c6107af6e..9efd6b2aec 100644 --- a/reference/mysql/functions/mysql-drop-db.xml +++ b/reference/mysql/functions/mysql-drop-db.xml @@ -1,5 +1,5 @@ - + mysql_drop_db @@ -34,12 +34,7 @@ - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; @@ -87,8 +82,8 @@ if (mysql_query($sql, $link)) { - For downward compatibility mysql_dropdb - can also be used. This is also deprecated, however. + &info.deprecated.alias; + mysql_dropdb diff --git a/reference/mysql/functions/mysql-errno.xml b/reference/mysql/functions/mysql-errno.xml index a370819ba4..3761d4450e 100644 --- a/reference/mysql/functions/mysql-errno.xml +++ b/reference/mysql/functions/mysql-errno.xml @@ -1,5 +1,5 @@ - + mysql_errno @@ -31,12 +31,7 @@ &reftitle.parameters; - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-error.xml b/reference/mysql/functions/mysql-error.xml index 98eab3abb2..510b5db45b 100644 --- a/reference/mysql/functions/mysql-error.xml +++ b/reference/mysql/functions/mysql-error.xml @@ -1,5 +1,5 @@ - + mysql_error @@ -28,12 +28,7 @@ &reftitle.parameters; - - link_identifier - - &mysql.linkid.description; - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-fetch-array.xml b/reference/mysql/functions/mysql-fetch-array.xml index b77293391a..dc7fd637a4 100644 --- a/reference/mysql/functions/mysql-fetch-array.xml +++ b/reference/mysql/functions/mysql-fetch-array.xml @@ -1,5 +1,5 @@ - + mysql_fetch_array @@ -22,14 +22,7 @@ &reftitle.parameters; - - result - - - The result that's being fetched. - - - + &mysql.result.description; result_type diff --git a/reference/mysql/functions/mysql-fetch-assoc.xml b/reference/mysql/functions/mysql-fetch-assoc.xml index c8404e54a4..8c066c14e0 100644 --- a/reference/mysql/functions/mysql-fetch-assoc.xml +++ b/reference/mysql/functions/mysql-fetch-assoc.xml @@ -1,29 +1,39 @@ - - + mysql_fetch_assoc - - Fetch a result row as an associative array - + Fetch a result row as an associative array - - Description + + + &reftitle.description; arraymysql_fetch_assoc resourceresult - Returns an associative array that corresponds to the fetched row, - or &false; if there are no more rows. - + Returns an associative array that corresponds to the fetched row. mysql_fetch_assoc is equivalent to calling mysql_fetch_array with MYSQL_ASSOC for the - optional second parameter. It only returns an associative array. - This is the way mysql_fetch_array originally - worked. If you need the numeric indices as well as the - associative, use mysql_fetch_array. + optional second parameter. It only returns an associative array. + + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + Returns an associative array that corresponds to the fetched row, or + &false; if there are no more rows. If two or more columns of the result have the same field names, @@ -34,15 +44,10 @@ See the example at the mysql_fetch_array description about aliases. - - An important thing to note is that using - mysql_fetch_assoc is not - significantly slower than using - mysql_fetch_row, while it - provides a significant added value. - - &database.field-case; - &database.fetch-null; + + + + &reftitle.examples; An expanded <function>mysql_fetch_assoc</function> example @@ -95,13 +100,34 @@ mysql_free_result($result); + + + + &reftitle.notes; + + Performance + + An important thing to note is that using + mysql_fetch_assoc is not + significantly slower than using + mysql_fetch_row, while it + provides a significant added value. + + + &database.field-case; + &database.fetch-null; + + + + &reftitle.seealso; - See also - mysql_fetch_row, - mysql_fetch_array, - mysql_data_seek, - mysql_query and - mysql_error. + + mysql_fetch_row + mysql_fetch_array + mysql_data_seek + mysql_query + mysql_error + diff --git a/reference/mysql/functions/mysql-fetch-field.xml b/reference/mysql/functions/mysql-fetch-field.xml index 727ac56e24..0fce20f90f 100644 --- a/reference/mysql/functions/mysql-fetch-field.xml +++ b/reference/mysql/functions/mysql-fetch-field.xml @@ -1,31 +1,50 @@ - - + mysql_fetch_field - - Get column information from a result and return as an object - + Get column information from a result and return as an object - - Description + + + &reftitle.description; objectmysql_fetch_field resourceresult intfield_offset - Returns an object containing field information. + Returns an object containing field information. This function can be used + to obtain information about fields in the provided query result. + + + + + &reftitle.parameters; + + + &mysql.result.description; + + field_offset + + + The numerical field offset. If the field offset is not specified, the + next field that was not yet retrieved by this function is retrieved. + The field_offset starts at 0. + + + + + + + + + &reftitle.returnvalues; + + Returns an object containing field information. The properties + of the object are: - mysql_fetch_field can be used in order to - obtain information about fields in a certain query result. If - the field offset isn't specified, the next field that wasn't yet - retrieved by mysql_fetch_field is retrieved. - - - The properties of the object are: @@ -89,7 +108,10 @@ - &database.field-case; + + + + &reftitle.examples; <function>mysql_fetch_field</function> example @@ -135,8 +157,19 @@ mysql_free_result($result); + + + + &reftitle.notes; + &database.field-case; + + + + &reftitle.seealso; - See also mysql_field_seek. + + mysql_field_seek + diff --git a/reference/mysql/functions/mysql-fetch-lengths.xml b/reference/mysql/functions/mysql-fetch-lengths.xml index e77eb15d7c..36d7fb204f 100644 --- a/reference/mysql/functions/mysql-fetch-lengths.xml +++ b/reference/mysql/functions/mysql-fetch-lengths.xml @@ -1,23 +1,20 @@ - - + mysql_fetch_lengths - - Get the length of each output in a result - + Get the length of each output in a result - - Description + + + &reftitle.description; arraymysql_fetch_lengths resourceresult Returns an array that corresponds to the lengths of each field - in the last row fetched by mysql_fetch_row, - or &false; on error. + in the last row fetched by MySQL. mysql_fetch_lengths stores the lengths of @@ -28,6 +25,26 @@ mysql_fetch_object in an array, starting at offset 0. + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + An array of lengths on success, or &false; on failure. + + + + + &reftitle.examples; A <function>mysql_fetch_lengths</function> example @@ -64,10 +81,16 @@ Array + + + + &reftitle.seealso; - See also mysql_field_len, - mysql_fetch_row, and - strlen. + + mysql_field_len + mysql_fetch_row + strlen + diff --git a/reference/mysql/functions/mysql-fetch-object.xml b/reference/mysql/functions/mysql-fetch-object.xml index 1772264250..d950487001 100644 --- a/reference/mysql/functions/mysql-fetch-object.xml +++ b/reference/mysql/functions/mysql-fetch-object.xml @@ -1,54 +1,48 @@ - - + mysql_fetch_object Fetch a result row as an object - - Description + + + &reftitle.description; objectmysql_fetch_object resourceresult - Returns an object with properties that correspond to the fetched - row, or &false; if there are no more rows. + Returns an object with properties that correspond to the fetched row. + + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + Returns an object with properties that correspond to the + fetched row, or &false; if there are no more rows. - mysql_fetch_object is similar to - mysql_fetch_array, with one difference - an - object is returned, instead of an array. Indirectly, that means - that you can only access the data by the field names, and not by - their offsets (numbers are illegal property names). + mysql_fetch_row fetches one row of data from + the result associated with the specified result identifier. The + row is returned as an array. Each result column is stored in an + array offset, starting at offset 0. - &database.field-case; - &database.fetch-null; + + + + &reftitle.examples; - - <function>mysql_fetch_object</function> example - -field; -/* this is invalid */ -// echo $row->0; - -?> -]]> - - - - - Speed-wise, the function is identical to - mysql_fetch_array, and almost as quick as - mysql_fetch_row (the difference is - insignificant). <function>mysql_fetch_object</function> example @@ -68,12 +62,60 @@ mysql_free_result($result); - See also - mysql_fetch_array, - mysql_fetch_assoc, - mysql_fetch_row, - mysql_data_seek and - mysql_query. + + <function>mysql_fetch_object</function> example + +field; +/* this is invalid */ +// echo $row->0; + +?> +]]> + + + + + + + &reftitle.notes; + + Performance + + Speed-wise, the function is identical to + mysql_fetch_array, and almost as quick as + mysql_fetch_row (the difference is + insignificant). + + + + + mysql_fetch_object is similar to + mysql_fetch_array, with one difference - an + object is returned, instead of an array. Indirectly, that means + that you can only access the data by the field names, and not by + their offsets (numbers are illegal property names). + + + &database.field-case; + &database.fetch-null; + + + + &reftitle.seealso; + + + mysql_fetch_array + mysql_fetch_assoc + mysql_fetch_row + mysql_data_seek + mysql_query + diff --git a/reference/mysql/functions/mysql-fetch-row.xml b/reference/mysql/functions/mysql-fetch-row.xml index 1c857370d7..aec148588e 100644 --- a/reference/mysql/functions/mysql-fetch-row.xml +++ b/reference/mysql/functions/mysql-fetch-row.xml @@ -1,33 +1,47 @@ - - + mysql_fetch_row Get a result row as an enumerated array - - Description + + + &reftitle.description; arraymysql_fetch_row resourceresult - Returns an array that corresponds to the fetched row, or &false; - if there are no more rows. + Returns a numerical array that corresponds to the fetched row. + + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + Returns an numerical array that corresponds to the fetched row, or + &false; if there are no more rows. - &database.fetch-null; mysql_fetch_row fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0. - - Subsequent call to mysql_fetch_row would - return the next row in the result set, or &false; if there are no - more rows. - + + + + &reftitle.examples; Fetching one row with <function>mysql_fetch_row</function> @@ -48,14 +62,24 @@ echo $row[1]; // the email value + + + + &reftitle.notes; + &database.fetch-null; + + + + &reftitle.seealso; - See also - mysql_fetch_array, - mysql_fetch_assoc, - mysql_fetch_object, - mysql_data_seek, - mysql_fetch_lengths and - mysql_result. + + mysql_fetch_array + mysql_fetch_assoc + mysql_data_object + mysql_data_seek + mysql_fetch_lengths + mysql_result + diff --git a/reference/mysql/functions/mysql-field-flags.xml b/reference/mysql/functions/mysql-field-flags.xml index 4704a7e053..01426e6c3e 100644 --- a/reference/mysql/functions/mysql-field-flags.xml +++ b/reference/mysql/functions/mysql-field-flags.xml @@ -1,15 +1,13 @@ - - + mysql_field_flags - - Get the flags associated with the specified field in a result - + Get the flags associated with the specified field in a result - - Description + + + &reftitle.description; stringmysql_field_flags resourceresult @@ -21,14 +19,36 @@ per flag separated by a single space, so that you can split the returned value using explode. - The following flags are reported, if your version of MySQL + + + + &reftitle.parameters; + + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.returnvalues; + + Returns a string of flags associated with the result, or &false; on failure. + + + The following flags are reported, if your version of MySQL is current enough to support them: "not_null", "primary_key", "unique_key", "multiple_key", "blob", "unsigned", "zerofill", "binary", "enum", - "auto_increment" et "timestamp". + "auto_increment" and "timestamp". + + + + &reftitle.examples; A <function>mysql_field_flags</function> example @@ -61,10 +81,16 @@ Array - - For downward compatibility mysql_fieldflags - can also be used. This is deprecated, however. - + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_fieldflags + + diff --git a/reference/mysql/functions/mysql-field-len.xml b/reference/mysql/functions/mysql-field-len.xml index 2333a068b4..7a459b653a 100644 --- a/reference/mysql/functions/mysql-field-len.xml +++ b/reference/mysql/functions/mysql-field-len.xml @@ -1,15 +1,13 @@ - - + mysql_field_len - - Returns the length of the specified field - + Returns the length of the specified field - - Description + + + &reftitle.description; intmysql_field_len resourceresult @@ -19,6 +17,27 @@ mysql_field_len returns the length of the specified field. + + + + &reftitle.parameters; + + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.returnvalues; + + The name of the specified field index on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_field_len</function> example @@ -40,13 +59,25 @@ echo $length; + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_fieldlen + + + + + + &reftitle.seealso; - For downward compatibility mysql_fieldlen - can also be used. This is deprecated, however. - - - See also mysql_fetch_lengths and - strlen. + + mysql_fetch_lengths + strlen + diff --git a/reference/mysql/functions/mysql-field-name.xml b/reference/mysql/functions/mysql-field-name.xml index 159e05fc00..dfcb5325e3 100644 --- a/reference/mysql/functions/mysql-field-name.xml +++ b/reference/mysql/functions/mysql-field-name.xml @@ -1,36 +1,43 @@ - - + mysql_field_name - - Get the name of the specified field in a result - + Get the name of the specified field in a result - - Description + + + &reftitle.description; stringmysql_field_name resourceresult - intfield_index + intfield_offset mysql_field_name returns the name of the - specified field index. result must be a - valid result identifier and field_index is - the numerical offset of the field. + specified field index. - - - field_index starts at 0. - - - e.g. The index of the third field would actually be 2, the index - of the fourth field would be 3 and so on. - - - &database.field-case; + + + + &reftitle.parameters; + + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.returnvalues; + + The name of the specified field index on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_field_name</function> example @@ -58,9 +65,7 @@ echo mysql_field_name($res, 2); ?> ]]> - - The above example would produce the following output: - + &example.outputs; - - For downwards compatibility mysql_fieldname - can also be used. This is deprecated, however. - + + + + &reftitle.notes; + &database.field-case; + + + &info.deprecated.alias; + mysql_fieldname + + diff --git a/reference/mysql/functions/mysql-field-seek.xml b/reference/mysql/functions/mysql-field-seek.xml index 3eef26b7f1..5f5f600082 100644 --- a/reference/mysql/functions/mysql-field-seek.xml +++ b/reference/mysql/functions/mysql-field-seek.xml @@ -1,15 +1,13 @@ - - + mysql_field_seek - - Set result pointer to a specified field offset - + Set result pointer to a specified field offset - - Description + + + &reftitle.description; intmysql_field_seek resourceresult @@ -21,8 +19,24 @@ offset, the field offset specified in mysql_field_seek will be returned. + + + + &reftitle.parameters; - See also mysql_fetch_field. + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.seealso; + + + mysql_fetch_field + diff --git a/reference/mysql/functions/mysql-field-table.xml b/reference/mysql/functions/mysql-field-table.xml index 32638c9aa7..d7a7641625 100644 --- a/reference/mysql/functions/mysql-field-table.xml +++ b/reference/mysql/functions/mysql-field-table.xml @@ -1,24 +1,42 @@ - - + mysql_field_table - - Get name of the table the specified field is in - + Get name of the table the specified field is in - - Description + + + &reftitle.description; stringmysql_field_table resourceresult intfield_offset - Returns the name of the table that the specified field is - in. + Returns the name of the table that the specified field is in. + + + + &reftitle.parameters; + + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.returnvalues; + + The name of the table on success. + + + + + &reftitle.examples; A <function>mysql_field_table</function> example @@ -39,12 +57,24 @@ echo $table; // people + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_fieldtable + + + + + + &reftitle.seealso; - For downward compatibility mysql_fieldtable - can also be used. This is deprecated, however. - - - See also mysql_list_tables. + + mysql_list_tables + diff --git a/reference/mysql/functions/mysql-field-type.xml b/reference/mysql/functions/mysql-field-type.xml index eb3e76e2fd..8b6ebcf7fe 100644 --- a/reference/mysql/functions/mysql-field-type.xml +++ b/reference/mysql/functions/mysql-field-type.xml @@ -1,15 +1,13 @@ - - + mysql_field_type - - Get the type of the specified field in a result - + Get the type of the specified field in a result - - Description + + + &reftitle.description; stringmysql_field_type resourceresult @@ -18,11 +16,34 @@ mysql_field_type is similar to the mysql_field_name function. The arguments are - identical, but the field type is returned instead. The field type + identical, but the field type is returned instead. + + + + + &reftitle.parameters; + + + &mysql.result.description; + &mysql.field-offset.req.description; + + + + + + &reftitle.returnvalues; + + The returned field type will be one of "int", "real", "string", "blob", and others as detailed in the MySQL documentation. + + + + + &reftitle.examples; + <function>mysql_field_type</function> example @@ -48,9 +69,7 @@ mysql_close(); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; - - For downward compatibility mysql_fieldtype - can also be used. This is deprecated, however. - + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_fieldtype + + diff --git a/reference/mysql/functions/mysql-free-result.xml b/reference/mysql/functions/mysql-free-result.xml index 7c8b33fc68..1bb161f77f 100644 --- a/reference/mysql/functions/mysql-free-result.xml +++ b/reference/mysql/functions/mysql-free-result.xml @@ -1,13 +1,13 @@ - - + mysql_free_result Free result memory - - Description + + + &reftitle.description; boolmysql_free_result resourceresult @@ -22,6 +22,19 @@ that return large result sets. All associated result memory is automatically freed at the end of the script's execution. + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; &return.success; @@ -31,6 +44,10 @@ mysql_query only returns a resource for SELECT, SHOW, EXPLAIN, and DESCRIBE queries. + + + + &reftitle.examples; A <function>mysql_free_result</function> example @@ -55,13 +72,25 @@ echo $row['email']; + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_freeresult + + + + + + &reftitle.seealso; - For downward compatibility mysql_freeresult - can also be used. This is deprecated, however. - - - See also mysql_query and - is_resource. + + mysql_query + is_resource + diff --git a/reference/mysql/functions/mysql-get-client-info.xml b/reference/mysql/functions/mysql-get-client-info.xml index d67aab1e5e..652992491f 100644 --- a/reference/mysql/functions/mysql-get-client-info.xml +++ b/reference/mysql/functions/mysql-get-client-info.xml @@ -1,13 +1,13 @@ - - + mysql_get_client_info Get MySQL client info - - Description + + + &reftitle.description; stringmysql_get_client_info @@ -16,6 +16,17 @@ mysql_get_client_info returns a string that represents the client library version. + + + + &reftitle.returnvalues; + + The MySQL client version. + + + + + &reftitle.examples; <function>mysql_get_client_info</function> example @@ -26,9 +37,7 @@ printf("MySQL client info: %s\n", mysql_get_client_info()); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_get_host_info, - mysql_get_proto_info and - mysql_get_server_info. + + mysql_get_host_info + mysql_get_proto_info + mysql_get_server_info + diff --git a/reference/mysql/functions/mysql-get-host-info.xml b/reference/mysql/functions/mysql-get-host-info.xml index c58cde688a..a619a5036c 100644 --- a/reference/mysql/functions/mysql-get-host-info.xml +++ b/reference/mysql/functions/mysql-get-host-info.xml @@ -1,24 +1,42 @@ - - + mysql_get_host_info Get MySQL host info - - Description + + + &reftitle.description; stringmysql_get_host_info resourcelink_identifier - mysql_get_host_info returns a string - describing the type of connection in use for the connection - link_identifier, including the server host - name. If link_identifier is omitted, the - last opened connection will be used. + Describes the type of connection in use for the connection, including the + server host name. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns a string describing the type of MySQL connection in use for the + connection or &false; on failure. + + + + + &reftitle.examples; <function>mysql_get_host_info</function> example @@ -33,9 +51,7 @@ printf("MySQL host info: %s\n", mysql_get_host_info()); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_get_client_info, - mysql_get_proto_info and - mysql_get_server_info. + + mysql_get_client_info + mysql_get_proto_info + mysql_get_server_info + diff --git a/reference/mysql/functions/mysql-get-proto-info.xml b/reference/mysql/functions/mysql-get-proto-info.xml index e7fc7711a3..82631d3738 100644 --- a/reference/mysql/functions/mysql-get-proto-info.xml +++ b/reference/mysql/functions/mysql-get-proto-info.xml @@ -1,24 +1,40 @@ - - + mysql_get_proto_info Get MySQL protocol info - - Description + + + &reftitle.description; intmysql_get_proto_info resourcelink_identifier - mysql_get_proto_info returns the protocol - version used by connection - link_identifier. If - link_identifier is omitted, the last opened - connection will be used. + Retrieves the MySQL protocol. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns the MySQL protocol on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_get_proto_info</function> example @@ -33,9 +49,7 @@ printf("MySQL protocol version: %s\n", mysql_get_proto_info()); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_get_client_info, - mysql_get_host_info and - mysql_get_server_info. + + mysql_get_client_info + mysql_get_host_info + mysql_get_server_info + diff --git a/reference/mysql/functions/mysql-get-server-info.xml b/reference/mysql/functions/mysql-get-server-info.xml index 68f4040c18..670f7f834a 100644 --- a/reference/mysql/functions/mysql-get-server-info.xml +++ b/reference/mysql/functions/mysql-get-server-info.xml @@ -1,24 +1,40 @@ - - + mysql_get_server_info Get MySQL server info - - Description + + + &reftitle.description; stringmysql_get_server_info resourcelink_identifier - mysql_get_server_info returns the server - version used by connection - link_identifier. If - link_identifier is omitted, the last opened - connection will be used. + Retrieves the MySQL server version. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns the MySQL server version on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_get_server_info</function> example @@ -33,9 +49,7 @@ printf("MySQL server version: %s\n", mysql_get_server_info()); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_get_client_info, - mysql_get_host_info, - mysql_get_proto_info, and - phpversion. + + mysql_get_client_info + mysql_get_host_info + mysql_get_proto_info + phpversion + diff --git a/reference/mysql/functions/mysql-info.xml b/reference/mysql/functions/mysql-info.xml index baf4cf7c05..a4ae3c565c 100644 --- a/reference/mysql/functions/mysql-info.xml +++ b/reference/mysql/functions/mysql-info.xml @@ -1,31 +1,50 @@ - - + mysql_info - - Get information about the most recent query - + Get information about the most recent query - - Description + + + &reftitle.description; stringmysql_info resourcelink_identifier - mysql_info returns detailed information about - the last query using the given link_identifier. - If link_identifier isn't specified, the last - opened link is assumed. + Returns detailed information about the last query. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns information about the statement on success, or &false; on + failure. See the example below for which statements provide information, + and what the returned value may look like. Statements that aren't listed + will return &false; + + + + + &reftitle.examples; - mysql_info returns a string for all statements - listed below. For everything else, it returns &false;. The string - format depends on the given statement. Relevant MySQL Statements + + Statements that return string values. The numbers are only for + illustrating purpose; their values will correspond to the query. + - - The numbers are only for illustrating purpose; their values will - correspond to the query. + + + + + &reftitle.notes; mysql_info returns a non-&false; value for the INSERT ... VALUES statement only if multiple value lists are specified in the statement. - + + + + + &reftitle.seealso; - See also - mysql_affected_rows, - mysql_insert_id, and - mysql_stat. + + mysql_affected_rows + mysql_insert_id + mysql_stat + diff --git a/reference/mysql/functions/mysql-insert-id.xml b/reference/mysql/functions/mysql-insert-id.xml index fc25af1eaf..1b6d9d32e8 100644 --- a/reference/mysql/functions/mysql-insert-id.xml +++ b/reference/mysql/functions/mysql-insert-id.xml @@ -1,53 +1,44 @@ - - + mysql_insert_id - - Get the ID generated from the previous INSERT operation - + Get the ID generated from the previous INSERT operation - - Description + + + &reftitle.description; intmysql_insert_id resourcelink_identifier - mysql_insert_id returns the ID generated for - an AUTO_INCREMENT column by the previous INSERT query using the - given link_identifier. If - link_identifier isn't specified, the last - opened link is assumed. + Retrieves the ID generated for an AUTO_INCREMENT column by the previous + INSERT query. + + + + &reftitle.parameters; - mysql_insert_id returns 0 if the previous - query does not generate an AUTO_INCREMENT value. If you need to - save the value for later, be sure to call - mysql_insert_id immediately after the - query that generates the value. + + &mysql.linkid.description; + - - - The value of the MySQL SQL function - LAST_INSERT_ID() always contains the most - recently generated AUTO_INCREMENT value, and is not reset - between queries. + + + + &reftitle.returnvalues; + + The ID generated for an AUTO_INCREMENT column by the previous + INSERT query on success, 0 if the previous + query does not generate an AUTO_INCREMENT value, or &false; if + no MySQL connection was established. - - - - mysql_insert_id converts the return type of - the native MySQL C API function - mysql_insert_id() to a type of - long (named int in PHP). - If your AUTO_INCREMENT column has a column type of BIGINT, - the value returned by mysql_insert_id - will be incorrect. Instead, use the internal MySQL SQL function - LAST_INSERT_ID() in an SQL query. - - + + + + &reftitle.examples; <function>mysql_insert_id</function> example @@ -67,10 +58,46 @@ printf("Last inserted record has id %d\n", mysql_insert_id()); + + + + &reftitle.notes; + + + mysql_insert_id converts the return type of + the native MySQL C API function + mysql_insert_id() to a type of + long (named int in PHP). + If your AUTO_INCREMENT column has a column type of BIGINT, + the value returned by mysql_insert_id + will be incorrect. Instead, use the internal MySQL SQL function + LAST_INSERT_ID() in an SQL query. + + + + + Because mysql_insert_id acts on the last performed + query, be sure to call mysql_insert_id immediately + after the query that generates the value. + + + + + The value of the MySQL SQL function + LAST_INSERT_ID() always contains the most + recently generated AUTO_INCREMENT value, and is not reset + between queries. + + + + + + &reftitle.seealso; - See also - mysql_query and - mysql_info. + + mysql_query + mysql_info + diff --git a/reference/mysql/functions/mysql-list-dbs.xml b/reference/mysql/functions/mysql-list-dbs.xml index 9d6668fc1b..abd0ddf1e5 100644 --- a/reference/mysql/functions/mysql-list-dbs.xml +++ b/reference/mysql/functions/mysql-list-dbs.xml @@ -1,26 +1,44 @@ - - + mysql_list_dbs - - List databases available on a MySQL server - + List databases available on a MySQL server - - Description + + + &reftitle.description; resourcemysql_list_dbs resourcelink_identifier - mysql_list_dbs will return a result pointer - containing the databases available from the current mysql - daemon. Use the mysql_tablename function to - traverse this result pointer, or any function for result tables, - such as mysql_fetch_array. + Returns a result pointer containing the databases available from the + current mysql daemon. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns a result pointer resource on success, or &false; on + failure. Use the mysql_tablename function to traverse + this result pointer, or any function for result tables, such as + mysql_fetch_array. + + + + + &reftitle.examples; <function>mysql_list_dbs</function> example @@ -36,33 +54,35 @@ while ($row = mysql_fetch_object($db_list)) { ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.notes; - The above code would just as easily work with - mysql_fetch_row or other similar functions. + &info.deprecated.alias; + mysql_listdbs + + + + &reftitle.seealso; - For downward compatibility mysql_listdbs can - also be used. This is deprecated however. - - - See also - mysql_db_name, and - mysql_select_db. + + mysql_db_name + mysql_select_db + diff --git a/reference/mysql/functions/mysql-list-fields.xml b/reference/mysql/functions/mysql-list-fields.xml index c9c6dff0a6..2806614e46 100644 --- a/reference/mysql/functions/mysql-list-fields.xml +++ b/reference/mysql/functions/mysql-list-fields.xml @@ -1,35 +1,70 @@ - - + mysql_list_fields List MySQL table fields - - Description + + + &reftitle.description; resourcemysql_list_fields stringdatabase_name stringtable_name resourcelink_identifier - - - The function mysql_list_fields is deprecated. It - is preferable to use mysql_query to issue a - SQL SHOW COLUMNS FROM table [LIKE 'name'] Statement instead. - - - mysql_list_fields retrieves information - about the given table name. Arguments are the database and - the table name. A result pointer is returned which can be used - with mysql_field_flags, + Retrieves information about the given table name. + + + This function is deprecated. It is preferable to use + mysql_query to issue a SQL SHOW COLUMNS FROM + table [LIKE 'name'] statement instead. + + + + + &reftitle.parameters; + + + + database_name + + + The name of the database that's being queried. + + + + + table_name + + + The name of the table that's being queried. + + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + A result pointer resource on success, or &false; on + failure. + + + The returned result can be used with mysql_field_flags, mysql_field_len, - mysql_field_name, and + mysql_field_name&listendand; mysql_field_type. + + + + &reftitle.examples; Alternate to deprecated <function>mysql_list_fields</function> @@ -49,9 +84,7 @@ if (mysql_num_rows($result) > 0) { ?> ]]> - - The above example would produce output similar to: - + &example.outputs.similar; + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_listfields + + + + + + &reftitle.seealso; - For downward compatibility mysql_listfields - can also be used. This is deprecated however. - - - See also - mysql_field_flags and - mysql_info. + + mysql_field_flags + mysql_info + diff --git a/reference/mysql/functions/mysql-list-processes.xml b/reference/mysql/functions/mysql-list-processes.xml index da4216dfab..cc5908cba8 100644 --- a/reference/mysql/functions/mysql-list-processes.xml +++ b/reference/mysql/functions/mysql-list-processes.xml @@ -1,21 +1,40 @@ - - + mysql_list_processes List MySQL processes - - Description + + + &reftitle.description; resourcemysql_list_processes resourcelink_identifier - mysql_list_processes returns a result pointer - describing the current server threads. + Retrieves the current MySQL server threads. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + A result pointer resource on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_list_processes</function> example @@ -33,9 +52,7 @@ mysql_free_result($result); ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_thread_id and - mysql_stat. + + mysql_thread_id + mysql_stat + diff --git a/reference/mysql/functions/mysql-list-tables.xml b/reference/mysql/functions/mysql-list-tables.xml index 4471a73e02..0a0e55922d 100644 --- a/reference/mysql/functions/mysql-list-tables.xml +++ b/reference/mysql/functions/mysql-list-tables.xml @@ -1,43 +1,59 @@ - - + mysql_list_tables List tables in a MySQL database - - Description + + + &reftitle.description; resourcemysql_list_tables stringdatabase resourcelink_identifier - mysql_list_tables takes a database name and - returns a result pointer much like the - mysql_query function. + Retrieves a list of table names from a MySQL database. + + + This function deprecated. It is preferable to use + mysql_query to issue a SQL SHOW TABLES + [FROM db_name] [LIKE 'pattern'] statement instead. + + + + + &reftitle.parameters; + + + + database + + + The name of the database + + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + A result pointer resource on success, or &false; on failure. + + Use the mysql_tablename function to traverse this result pointer, or any function for result tables, such as mysql_fetch_array. - - The database parameter is the name of the - database to retrieve the list of tables from. Upon failure, - mysql_list_tables returns &false;. - - - For downward compatibility, the function alias named - mysql_listtables can be used. This is - deprecated however and is not recommended. - - - - The function mysql_list_tables is deprecated. It - is preferable to use mysql_query to issue a - SQL SHOW TABLES [FROM db_name] [LIKE 'pattern'] statement instead. - - + + + + &reftitle.examples; <function>mysql_list_tables</function> alternative example @@ -70,10 +86,25 @@ mysql_free_result($result); + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_listtables + + + + + + &reftitle.seealso; - See also - mysql_list_dbs and - mysql_tablename. + + mysql_list_dbs + mysql_tablename + diff --git a/reference/mysql/functions/mysql-num-fields.xml b/reference/mysql/functions/mysql-num-fields.xml index 94b725b441..753964f985 100644 --- a/reference/mysql/functions/mysql-num-fields.xml +++ b/reference/mysql/functions/mysql-num-fields.xml @@ -1,21 +1,41 @@ - - + mysql_num_fields Get number of fields in result - - Description + + + &reftitle.description; intmysql_num_fields resourceresult - mysql_num_fields returns the number of - fields in the result set result. + Retrieves the number of fields from a query. + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + Returns the number of fields in the result set resource on + success, or &false; on failure. + + + + + &reftitle.examples; A <function>mysql_num_fields</function> example @@ -35,16 +55,27 @@ echo mysql_num_fields($result); + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_numfields + + + + + + &reftitle.seealso; - For downward compatibility mysql_numfields - can also be used. This is deprecated however. - - - See also - mysql_select_db, - mysql_query, - mysql_fetch_field and - mysql_num_rows. + + mysql_select_db + mysql_query + mysql_fetch_field + mysql_num_rows + diff --git a/reference/mysql/functions/mysql-num-rows.xml b/reference/mysql/functions/mysql-num-rows.xml index 085e4237b2..a6b417832a 100644 --- a/reference/mysql/functions/mysql-num-rows.xml +++ b/reference/mysql/functions/mysql-num-rows.xml @@ -1,22 +1,43 @@ - - + mysql_num_rows Get number of rows in result - - Description + + + &reftitle.description; intmysql_num_rows resourceresult - mysql_num_rows returns the number of rows in - a result set. This command is only valid for SELECT statements. - To retrieve the number of rows affected by a INSERT, UPDATE or - DELETE query, use mysql_affected_rows. + Retrieves the number of rows from a result set. This command is only valid + for SELECT statements. To retrieve the number of rows affected by a INSERT, + UPDATE, or DELETE query, use mysql_affected_rows. + + + + + &reftitle.parameters; + + + &mysql.result.description; + + + + + + &reftitle.returnvalues; + + The number of rows in a result set on success, or &false; on failure. + + + + + &reftitle.examples; + <function>mysql_num_rows</function> example @@ -36,6 +57,10 @@ echo "$num_rows Rows\n"; + + + + &reftitle.notes; If you use mysql_unbuffered_query, @@ -44,17 +69,24 @@ echo "$num_rows Rows\n"; retrieved. + + + &info.deprecated.alias; + mysql_numrows + + + + + + &reftitle.seealso; - See also - mysql_affected_rows, - mysql_connect, - mysql_data_seek, - mysql_select_db and - mysql_query. - - - For downward compatibility mysql_numrows can - also be used. This is deprecated however. + + mysql_affected_rows + mysql_connect + mysql_data_seek + mysql_select_db + mysql_query + diff --git a/reference/mysql/functions/mysql-pconnect.xml b/reference/mysql/functions/mysql-pconnect.xml index 231e2074d9..b49f48132e 100644 --- a/reference/mysql/functions/mysql-pconnect.xml +++ b/reference/mysql/functions/mysql-pconnect.xml @@ -1,15 +1,13 @@ - - + mysql_pconnect - - Open a persistent connection to a MySQL server - + Open a persistent connection to a MySQL server - - Description + + + &reftitle.description; resourcemysql_pconnect stringserver @@ -18,37 +16,9 @@ intclient_flags - Returns a positive MySQL persistent link identifier on success, - or &false; on error. + Establishes a persistent connection to a MySQL server. - - mysql_pconnect establishes a connection - to a MySQL server. The following defaults are assumed for - missing optional parameters: server = - 'localhost:3306', username = name of the - user that owns the server process and - password = empty password. - The client_flags - parameter can be a combination of the constants - MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_IGNORE_SPACE or - MYSQL_CLIENT_INTERACTIVE. - - - The server parameter can also include a port - number. e.g. "hostname:port" or a path to a socket - e.g. ":/path/to/socket" for the localhost. - - - Support for ":port" was added in 3.0B4. - - - Support for the ":/path/to/socket" was added in - 3.0.10. - - - - - + mysql_pconnect acts very much like mysql_connect with two major differences. @@ -65,13 +35,110 @@ open for future use (mysql_close will not close links established by mysql_pconnect). - - The optional client_flags parameter became - available in PHP 4.3.0. - This type of link is therefore called 'persistent'. + + + + &reftitle.parameters; + + + + server + + + The MySQL server. It can also include a port number. e.g. + "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for + the localhost. + + + If the PHP directive + mysql.default_host is undefined (default), then the default + value is 'localhost:3306' + + + + + username + + + The username. Default value is the name of the user that owns the + server process. + + + + + password + + + The password. Default value is an empty password. + + + + + client_flags + + + The client_flags parameter can be a combination + of the following constants: + MYSQL_CLIENT_COMPRESS, + MYSQL_CLIENT_IGNORE_SPACE or + MYSQL_CLIENT_INTERACTIVE. + + + + + + + + + &reftitle.returnvalues; + + Returns a MySQL persistent link identifier on success, or &false; on + failure. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.0 + + Added the client_flags parameter. + + + + 3.0.10 + + Added support for ":/path/to/socket" with + server. + + + + 3.0.0 + + Added support for ":port" with server. + + + + + + + + + + &reftitle.notes; Note, that these kind of links only work if you are using @@ -87,6 +154,24 @@ connections allowed by MySQL. + + + You can suppress the error message on failure by prepending + a @ + to the function name. + + + + + + &reftitle.seealso; + + + mysql_connect + Persistent + Database Connections + + diff --git a/reference/mysql/functions/mysql-ping.xml b/reference/mysql/functions/mysql-ping.xml index 64a0e7774e..0934a5bc64 100644 --- a/reference/mysql/functions/mysql-ping.xml +++ b/reference/mysql/functions/mysql-ping.xml @@ -1,26 +1,45 @@ - - + mysql_ping Ping a server connection or reconnect if there is no connection - - Description + + + &reftitle.description; boolmysql_ping resourcelink_identifier - mysql_ping checks whether or not the connection to + Checks whether or not the connection to the server is working. If it has gone down, an automatic reconnection is attempted. This function can be used by scripts that remain idle for a long while, to check whether or not the server has closed the connection and reconnect if necessary. - mysql_ping returns &true; if the connection to the - server is working, otherwise &false;. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns &true; if the connection to the server MySQL server is working, + otherwise &false;. + + + + + &reftitle.examples; A <function>mysql_ping</function> example @@ -53,10 +72,15 @@ $result2 = mysql_query($sql2); + + + + &reftitle.seealso; - See also - mysql_thread_id and - mysql_list_processes. + + mysql_thread_id + mysql_list_processes + diff --git a/reference/mysql/functions/mysql-query.xml b/reference/mysql/functions/mysql-query.xml index 040fe76a9b..598237d7bb 100644 --- a/reference/mysql/functions/mysql-query.xml +++ b/reference/mysql/functions/mysql-query.xml @@ -1,5 +1,5 @@ - + @@ -36,20 +36,7 @@ - - link_identifier - - - A link identifier, as returned by mysql_connect. - - - If 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 mysql_connect was - called with no arguments, and use it. The result of the query is buffered. - - - + &mysql.linkid.description; @@ -59,13 +46,13 @@ For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query - returns a resource on success, and &false; on + returns a resource on success, or &false; on error. For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_query returns &true; on success - and &false; on error. + or &false; on error. The returned result resource should be passed to diff --git a/reference/mysql/functions/mysql-real-escape-string.xml b/reference/mysql/functions/mysql-real-escape-string.xml index f87bee8a8f..acdf8bbfb8 100644 --- a/reference/mysql/functions/mysql-real-escape-string.xml +++ b/reference/mysql/functions/mysql-real-escape-string.xml @@ -1,49 +1,24 @@ - - + mysql_real_escape_string - - Escapes special characters in a string for use in a SQL statement - + Escapes special characters in a string for use in a SQL statement - - Description + + + &reftitle.description; stringmysql_real_escape_string stringunescaped_string resourcelink_identifier - - - unescaped_string - The string to escape - - - - link_identifier (optional) - The mysql connection resource - - + Escapes special characters in the unescaped_string, + taking into account the current character set of the connection so that it + is safe to place it in a mysql_query. If binary data + is to be inserted, this function must be used. - - This function will escape special characters in the - unescaped_string, taking into account the current - character set of the connection so that it is safe to place it in a - mysql_query. If binary data is to be inserted, this function - must be used. - - - - A MySQL connection is required before using - mysql_real_escape_string otherwise an error of - level E_WARNING is generated, and &false; is - returned. If link_identifier isn't defined, the - last MySQL connection is used. - - mysql_real_escape_string calls MySQL's library function mysql_escape_string, which prepends backslashes to the following characters: @@ -51,6 +26,38 @@ \r, \, ', " and \x1a. + + This function must always (with few exceptions) be used to make data + safe before sending a query to MySQL. + + + + + &reftitle.parameters; + + + + unescaped_string + + + The string that is to be escaped. + + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + Returns the escaped string, or &false; on error. + + + + + &reftitle.examples; Simple <function>mysql_real_escape_string</function> example @@ -70,21 +77,6 @@ $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'", - - This function must always (with few exceptions) be used to make data - safe before sending a query to MySQL. - - - - If magic_quotes_gpc is enabled, - first apply stripslashes to the data. Using this function - on data which has already been escaped will escape the data twice. - - - - If this function is not used to escape data, the query is vulnerable to - SQL Injection Attacks. - An example SQL Injection Attack @@ -161,6 +153,32 @@ mysql_query($query); + + + + &reftitle.notes; + + + A MySQL connection is required before using + mysql_real_escape_string otherwise an error of + level E_WARNING is generated, and &false; is + returned. If link_identifier isn't defined, the + last MySQL connection is used. + + + + + If magic_quotes_gpc is enabled, + first apply stripslashes to the data. Using this function + on data which has already been escaped will escape the data twice. + + + + + If this function is not used to escape data, the query is vulnerable to + SQL Injection Attacks. + + mysql_real_escape_string does not escape @@ -169,15 +187,18 @@ mysql_query($query); or REVOKE. + + + + &reftitle.seealso; - See also - mysql_client_encoding, - addslashes, - stripslashes, - the magic_quotes_gpc, - and the - magic_quotes_runtime - directive. + + mysql_client_encoding + addslashes + stripslashes + The magic_quotes_gpc directive + The magic_quotes_runtime directive + diff --git a/reference/mysql/functions/mysql-result.xml b/reference/mysql/functions/mysql-result.xml index b40556ff8d..063ebec034 100644 --- a/reference/mysql/functions/mysql-result.xml +++ b/reference/mysql/functions/mysql-result.xml @@ -1,13 +1,13 @@ - - + mysql_result Get result data - - Description + + + &reftitle.description; mixedmysql_result resourceresult @@ -15,12 +15,7 @@ mixedfield - mysql_result returns the contents of one - cell from a MySQL result set. The field argument can be the - field's offset, or the field's name, or the field's table dot - field name (tablename.fieldname). If the column name has been - aliased ('select foo as bar from...'), use the alias instead of - the column name. + Retrieves the contents of one cell from a MySQL result set. When working on large result sets, you should consider using one @@ -31,10 +26,50 @@ numeric offset for the field argument is much quicker than specifying a fieldname or tablename.fieldname argument. + + + + &reftitle.parameters; - Calls to mysql_result should not be mixed - with calls to other functions that deal with the result set. + + &mysql.result.description; + + row + + + The row number from the result that's being retrieved. Row numbers + start at 0. + + + + + field + + + The name or offset of the field being retrieved. + + + It can be the field's offset, the field's name, or the field's table + dot field name (tablename.fieldname). If the column name has been + aliased ('select foo as bar from...'), use the alias instead of the + column name. If undefined, the first field is retrieved. + + + + + + + + &reftitle.returnvalues; + + The contents of one cell from a MySQL result set on success, or + &false; on failure. + + + + + &reftitle.examples; <function>mysql_result</function> example @@ -57,12 +92,27 @@ mysql_close($link); + + + + &reftitle.notes; + + + Calls to mysql_result should not be mixed + with calls to other functions that deal with the result set. + + + + + + &reftitle.seealso; - Recommended high-performance alternatives : - mysql_fetch_row, - mysql_fetch_array, - mysql_fetch_assoc and - mysql_fetch_object. + + mysql_fetch_row + mysql_fetch_array + mysql_fetch_assoc + mysql_fetch_object + diff --git a/reference/mysql/functions/mysql-select-db.xml b/reference/mysql/functions/mysql-select-db.xml index 8d1f8dc8f5..5bef88ec98 100644 --- a/reference/mysql/functions/mysql-select-db.xml +++ b/reference/mysql/functions/mysql-select-db.xml @@ -1,33 +1,51 @@ - - + mysql_select_db Select a MySQL database - - Description + + + &reftitle.description; boolmysql_select_db stringdatabase_name resourcelink_identifier + + Sets the current active database on the server that's associated with the + specified link identifier. Every subsequent call to + mysql_query will be made on the active database. + + + + + &reftitle.parameters; + + + + database_name + + + The name of the database that is to be selected. + + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; &return.success; - - mysql_select_db sets the current active - database on the server that's associated with the specified link - identifier. If no link identifier is specified, the last opened - link is assumed. If no link is open, the function will try to - establish a link as if mysql_connect was - called without arguments, and use it. - - - Every subsequent call to mysql_query will be - made on the active database. - + + + + &reftitle.examples; <function>mysql_select_db</function> example @@ -50,15 +68,26 @@ if (!$db_selected) { + + + + &reftitle.notes; + + + &info.deprecated.alias; + mysql_createdb + + + + + + &reftitle.seealso; - See also - mysql_connect, - mysql_pconnect and - mysql_query. - - - For downward compatibility mysql_selectdb - can also be used. This is deprecated however. + + mysql_connect + mysql_pconnect + mysql_query + diff --git a/reference/mysql/functions/mysql-stat.xml b/reference/mysql/functions/mysql-stat.xml index c942a8d1a8..e33091f737 100644 --- a/reference/mysql/functions/mysql-stat.xml +++ b/reference/mysql/functions/mysql-stat.xml @@ -1,5 +1,5 @@ - + @@ -20,14 +20,7 @@ &reftitle.parameters; - - link_identifier - - - Link to the MySQL connection. - - - + &mysql.linkid.description; diff --git a/reference/mysql/functions/mysql-tablename.xml b/reference/mysql/functions/mysql-tablename.xml index 96d3f1488d..6c07336637 100644 --- a/reference/mysql/functions/mysql-tablename.xml +++ b/reference/mysql/functions/mysql-tablename.xml @@ -1,27 +1,68 @@ - - + mysql_tablename Get table name of field - - Description + + + &reftitle.description; stringmysql_tablename resourceresult inti - mysql_tablename takes a result pointer - returned by the mysql_list_tables function - as well as an integer index and returns the name of a table. The - mysql_num_rows function may be used to - determine the number of tables in the result pointer. + Retrieves the table name from a result. + + + This function deprecated. It is preferable to use + mysql_query to issue a SQL SHOW TABLES + [FROM db_name] [LIKE 'pattern'] statement instead. + + + + + &reftitle.parameters; + + + + result + + + A result pointer resource that's returned from + mysql_list_tables. + + + + + i + + + The integer index (row/table number) + + + + + + + + + &reftitle.returnvalues; + + The name of the table on success, or &false; on failure. + + Use the mysql_tablename function to traverse this result pointer, or any function for result tables, such as mysql_fetch_array. + + + + + &reftitle.examples; + <function>mysql_tablename</function> example @@ -40,11 +81,26 @@ mysql_free_result($result); + + + + &reftitle.notes; + + + The mysql_num_rows function may be used to + determine the number of tables in the result pointer. + + + + + + &reftitle.seealso; - See also - mysql_list_tables, - mysql_field_table, and - mysql_db_name. + + mysql_list_tables + mysql_field_table + mysql_db_name + diff --git a/reference/mysql/functions/mysql-thread-id.xml b/reference/mysql/functions/mysql-thread-id.xml index 1f13442a03..b066d6c806 100644 --- a/reference/mysql/functions/mysql-thread-id.xml +++ b/reference/mysql/functions/mysql-thread-id.xml @@ -1,24 +1,42 @@ - - + mysql_thread_id Return the current thread ID - - Description + + + &reftitle.description; intmysql_thread_id resourcelink_identifier - mysql_thread_id returns the current thread ID. If - the connection is lost and you reconnect with - mysql_ping, the thread ID will change. This means - you should not get the thread ID and store it for later. You should get - it when you need it. + Retrieves the current thread ID. If the connection is lost, and a reconnect + with mysql_ping is executed, the thread ID will + change. This means only retrieve the thread ID when needed. + + + + &reftitle.parameters; + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + The thread ID on success, or &false; on failure. + + + + + &reftitle.examples; <function>mysql_thread_id</function> example @@ -33,9 +51,7 @@ if ($thread_id){ ?> ]]> - - The above example would produce the following output: - + &example.outputs.similar; + + + + &reftitle.seealso; - See also - mysql_ping and - mysql_list_processes. + + mysql_ping + mysql_list_processes + mysql_ + mysql_ + diff --git a/reference/mysql/functions/mysql-unbuffered-query.xml b/reference/mysql/functions/mysql-unbuffered-query.xml index 93d8415ea1..2043128975 100644 --- a/reference/mysql/functions/mysql-unbuffered-query.xml +++ b/reference/mysql/functions/mysql-unbuffered-query.xml @@ -1,16 +1,13 @@ - - + mysql_unbuffered_query - - Send an SQL query to MySQL, without fetching and buffering the - result rows - + Send an SQL query to MySQL, without fetching and buffering the result rows - - Description + + + &reftitle.description; resourcemysql_unbuffered_query stringquery @@ -29,6 +26,42 @@ have to specify the optional parameter link_identifier. + + + + &reftitle.parameters; + + + + query + + + A SQL query + + + + &mysql.linkid.description; + + + + + + &reftitle.returnvalues; + + For SELECT, SHOW, DESCRIBE or EXPLAIN statements, + mysql_query + returns a resource on success, or &false; on + error. + + + For other type of SQL statements, UPDATE, DELETE, DROP, etc, + mysql_query returns &true; on success + or &false; on error. + + + + + &reftitle.notes; The benefits of mysql_unbuffered_query come @@ -39,8 +72,14 @@ can send a new SQL query to MySQL. + + + + &reftitle.seealso; - See also mysql_query. + + mysql_query +