diff --git a/reference/mysql/functions/mysql-data-seek.xml b/reference/mysql/functions/mysql-data-seek.xml index 9a883ced26..e8d62c6b13 100644 --- a/reference/mysql/functions/mysql-data-seek.xml +++ b/reference/mysql/functions/mysql-data-seek.xml @@ -1,12 +1,12 @@ - + mysql_data_seek Move internal result pointer - - Description + + &reftitle.description; boolmysql_data_seek resourceresult_identifier diff --git a/reference/mysql/functions/mysql-db-name.xml b/reference/mysql/functions/mysql-db-name.xml index 8102ad4c04..3473d2634f 100644 --- a/reference/mysql/functions/mysql-db-name.xml +++ b/reference/mysql/functions/mysql-db-name.xml @@ -1,13 +1,12 @@ - - + mysql_db_name Get result data - - Description + + &reftitle.description; stringmysql_db_name resourceresult @@ -15,18 +14,54 @@ mixedfield - mysql_db_name takes as its first parameter - the result pointer from a call to - mysql_list_dbs. The - row parameter is an index into the result - set. + Retrieve the database name from a call to + mysql_list_dbs. + + + + &reftitle.parameters; - If an error occurs, &false; is returned. Use - mysql_errno and - mysql_error to determine the nature of the - error. + + + result + + + The result pointer from a call to mysql_list_dbs. + + + + + row + + + The index into the result set. + + + + + field + + + The field name. + + + + + + + + &reftitle.returnvalues; + + Returns the database name on success, and &false; on failure. If &false; + is returned, use mysql_error to determine the nature + of the error. + + + + + &reftitle.examples; <function>mysql_db_name</function> example @@ -49,14 +84,25 @@ while ($i < $cnt) { + + + + &reftitle.notes; + + + For backward compatibility, mysql_dbname is + also accepted. This is deprecated, however. + + + + + + &reftitle.seealso; - For backward compatibility, mysql_dbname is - also accepted. This is deprecated, however. - - - See also - mysql_list_dbs, and - mysql_tablename. + + mysql_list_dbs + mysql_tablename + diff --git a/reference/mysql/functions/mysql-db-query.xml b/reference/mysql/functions/mysql-db-query.xml index 9625553899..b436472b64 100644 --- a/reference/mysql/functions/mysql-db-query.xml +++ b/reference/mysql/functions/mysql-db-query.xml @@ -1,49 +1,93 @@ - - + mysql_db_query Send a MySQL query - - Description + + + &reftitle.description; resourcemysql_db_query stringdatabase stringquery resourcelink_identifier + + mysql_db_query selects a database, and executes a + query on it. + + + + + &reftitle.parameters; + + + + database + + + The name of the database that will be selected. + + + + + query + + + The MySQL query. + + + + + link_identifier + + &mysql.linkid.description; + + + + + + + + &reftitle.returnvalues; Returns a positive MySQL result resource to the query result, or &false; on error. The function also returns &true;/&false; for INSERT/UPDATE/DELETE queries to indicate success/failure. - - - This function has been deprecated since PHP 4.0.6. - Do not use this function. Use mysql_select_db - and mysql_query instead. - - + + + + &reftitle.changelog; - mysql_db_query selects a database and - executes a query on it. If the optional link identifier isn't - specified, the function will try to find an open link to the - MySQL server and if no such link is found it'll try to create one - as if mysql_connect was called with no - arguments. - - - Be aware that this function does NOT - switch back to the database you were connected before. In other words, - you can't use this function to temporarily run a - sql query on another database, you would have to manually switch back. - Users are strongly encouraged to use the - database.table syntax in their sql queries or - mysql_select_db instead of this function. + + + + + &Version; + &Description; + + + + + 4.0.6 + + This function is deprecated, do not use this function. Instead, use + mysql_select_db and + mysql_query instead. + + + + + + + + + &reftitle.examples; <function>mysql_db_query</function> alternative example @@ -81,9 +125,30 @@ mysql_free_result($result); + + + + &reftitle.notes; + + + Be aware that this function does NOT + switch back to the database you were connected before. In other words, + you can't use this function to temporarily run a + sql query on another database, you would have to manually switch back. + Users are strongly encouraged to use the + database.table syntax in their sql queries or + mysql_select_db instead of this function. + + + + + + &reftitle.seealso; - See also mysql_connect and - mysql_query. + + mysql_query + mysql_select_db + diff --git a/reference/mysql/functions/mysql-drop-db.xml b/reference/mysql/functions/mysql-drop-db.xml index 4363b6ed87..0c6107af6e 100644 --- a/reference/mysql/functions/mysql-drop-db.xml +++ b/reference/mysql/functions/mysql-drop-db.xml @@ -1,13 +1,13 @@ - - + mysql_drop_db Drop (delete) a MySQL database - - Description + + + &reftitle.description; boolmysql_drop_db stringdatabase_name @@ -16,22 +16,43 @@ mysql_drop_db attempts to drop (remove) an entire database from the server associated with the specified - link identifier. + link identifier. This function is deprecated, it is preferable to use + mysql_query to issue a sql + DROP DATABASE statement instead. + + + + &reftitle.parameters; + + + + database_name + + + The name of the database that will be deleted. + + + + + link_identifier + + &mysql.linkid.description; + + + + + + + + &reftitle.returnvalues; &return.success; - - For downward compatibility mysql_dropdb - can also be used. This is also deprecated, however. - - - - The function mysql_drop_db is deprecated. It is - preferable to use mysql_query to issue a sql - DROP DATABASE statement instead. - - + + + + &reftitle.examples; <function>mysql_drop_db</function> alternative example @@ -54,14 +75,30 @@ if (mysql_query($sql, $link)) { + + + + &reftitle.notes; - This function will not be available - if the MySQL extension was built against a MySQL 4.x client library. + This function will not be available if the MySQL extension was built + against a MySQL 4.x client library. + + + For downward compatibility mysql_dropdb + can also be used. This is also deprecated, however. + + + + + + &reftitle.seealso; - See also mysql_query. + + mysql_query + diff --git a/reference/mysql/functions/mysql-errno.xml b/reference/mysql/functions/mysql-errno.xml index 0fa05adbaa..a370819ba4 100644 --- a/reference/mysql/functions/mysql-errno.xml +++ b/reference/mysql/functions/mysql-errno.xml @@ -1,23 +1,19 @@ - - + mysql_errno - - Returns the numerical value of the error message from previous - MySQL operation - + Returns the numerical value of the error message from previous MySQL operation - - Description + + + &reftitle.description; intmysql_errno resourcelink_identifier - Returns the error number from the last MySQL function, or - 0 (zero) if no error occurred. + Returns the error number from the last MySQL function. Errors coming back from the MySQL database backend no longer @@ -26,8 +22,36 @@ error code from the most recently executed MySQL function (not including mysql_error and mysql_errno), so if you want to use it, - make sure you check the value before calling another MySQL - function. + make sure you check the value before calling another MySQL + function. + + + + + &reftitle.parameters; + + + + link_identifier + + &mysql.linkid.description; + + + + + + + + &reftitle.returnvalues; + + Returns the error number from the last MySQL function, or + 0 (zero) if no error occurred. + + + + + &reftitle.examples; + <function>mysql_errno</function> example @@ -46,27 +70,24 @@ if (!mysql_query("SELECT * FROM nonexistenttable", $link)) { ?> ]]> - - The above example would produce the following output: - - + &example.outputs.similar; + - + - - - If the optional argument is specified the given link - is used to retrieve the error code. If not, the last - opened link is used. - - + + + + &reftitle.seealso; - See also mysql_error and - MySQL error codes. + + mysql_error + MySQL error codes + diff --git a/reference/mysql/functions/mysql-error.xml b/reference/mysql/functions/mysql-error.xml index ead2ae9905..98eab3abb2 100644 --- a/reference/mysql/functions/mysql-error.xml +++ b/reference/mysql/functions/mysql-error.xml @@ -1,28 +1,19 @@ - - + mysql_error - - Returns the text of the error message from previous MySQL - operation - + Returns the text of the error message from previous MySQL operation - - Description + + + &reftitle.description; stringmysql_error resourcelink_identifier - Returns the error text from the last MySQL function, or - '' (the empty string) if no error occurred. - If no link is explicitly passed to the function, the last - successful open link will be used to retrieve the error message - from the MySQL server. - - + Returns the error text from the last MySQL function. Errors coming back from the MySQL database backend no longer issue warnings. Instead, use mysql_error to retrieve the error text. Note that this function only returns the @@ -30,6 +21,34 @@ including mysql_error and mysql_errno), so if you want to use it, make sure you check the value before calling another MySQL function. + + + + + &reftitle.parameters; + + + + link_identifier + + &mysql.linkid.description; + + + + + + + + &reftitle.returnvalues; + + Returns the error text from the last MySQL function, or + '' (empty string) if no error occurred. + + + + + &reftitle.examples; + <function>mysql_error</function> example @@ -46,20 +65,24 @@ echo mysql_errno($link) . ": " . mysql_error($link) . "\n"; ?> ]]> - - The above example would produce the following output: - - + &example.outputs.similar; + - + + + + + &reftitle.seealso; - See also mysql_errno and - MySQL error messages. + + mysql_errno + MySQL error codes + diff --git a/reference/mysql/functions/mysql-escape-string.xml b/reference/mysql/functions/mysql-escape-string.xml index f6c1be6932..efe7071882 100644 --- a/reference/mysql/functions/mysql-escape-string.xml +++ b/reference/mysql/functions/mysql-escape-string.xml @@ -1,15 +1,13 @@ - - + mysql_escape_string - - Escapes a string for use in a mysql_query - + Escapes a string for use in a mysql_query - - Description + + + &reftitle.description; stringmysql_escape_string stringunescaped_string @@ -17,20 +15,67 @@ This function will escape the unescaped_string, so that it is safe to place it in a mysql_query. + This function is deprecated. - - - mysql_escape_string does not escape - % and _. - - - This function is identical to mysql_real_escape_string except that - mysql_real_escape_string takes a connection handler and escapes the - string according to the current character - set. mysql_escape_string does not take a - connection argument and does not respect the current charset setting. - - + + This function is identical to mysql_real_escape_string + except that mysql_real_escape_string takes a + connection handler and escapes the string according to the current + character set. mysql_escape_string does not take a + connection argument and does not respect the current charset setting. + + + + + &reftitle.parameters; + + + + unescaped_string + + + The string that is to be escaped. + + + + + + + + + &reftitle.returnvalues; + + Returns the escaped string. + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 4.3.0 + + This function became deprecated, do not use this function. Instead, + use mysql_real_escape_string. + + + + + + + + + + &reftitle.examples; <function>mysql_escape_string</function> example @@ -43,9 +88,7 @@ printf("Escaped string: %s\n", $escaped_item); ?> ]]> - - The above example would produce the following output: - + &example.outputs; + + + + &reftitle.notes; + + + mysql_escape_string does not escape + % and _. + + + + + + &reftitle.seealso; - - - This function has been deprecated since PHP 4.3.0. - Do not use this function. Use mysql_real_escape_string - instead. - - - - - See also - mysql_real_escape_string, - addslashes and the - magic_quotes_gpc - directive. + + mysql_real_escape_string + addslashes + The magic_quotes_gpc directive. + diff --git a/reference/mysql/functions/mysql-fetch-array.xml b/reference/mysql/functions/mysql-fetch-array.xml index af5825cde4..b77293391a 100644 --- a/reference/mysql/functions/mysql-fetch-array.xml +++ b/reference/mysql/functions/mysql-fetch-array.xml @@ -1,36 +1,74 @@ - - + mysql_fetch_array - - Fetch a result row as an associative array, a numeric array, or both - + Fetch a result row as an associative array, a numeric array, or both - - Description + + + &reftitle.description; arraymysql_fetch_array resourceresult intresult_type - Returns an array that corresponds to the fetched row, or &false; - if there are no more rows. + Returns an array that corresponds to the fetched row. + + + + + &reftitle.parameters; - mysql_fetch_array is an extended version of - mysql_fetch_row. 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. + + + result + + + The result that's being fetched. + + + + + result_type + + + The type of array that is to be fetched. It's a constant and can + take the following values: MYSQL_ASSOC, + MYSQL_NUM, and the default value of + MYSQL_BOTH. + + + + + + + + + &reftitle.returnvalues; + + Returns an array that corresponds to the fetched row, or &false; + if there are no more rows. The type of returned array depends on + how result_type is defined. By using + MYSQL_BOTH (default), you'll get an array with both + associative and number indices. Using MYSQL_ASSOC, you + only get associative indices (as mysql_fetch_assoc + works), using MYSQL_NUM, you only get number indices + (as mysql_fetch_row works). 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 use the numeric index of the column or make an alias for the column. For aliased columns, you cannot - access the contents with the original column name (by using - 'field' in this example). + access the contents with the original column name. + + + + + &reftitle.examples; + Query with aliased duplicate field names @@ -40,37 +78,9 @@ SELECT table1.field AS foo, table2.field AS bar FROM table1, table2 - - An important thing to note is that using - mysql_fetch_array is not - significantly slower than using - mysql_fetch_row, while it provides - a significant added value. - - - The optional second argument result_type - in mysql_fetch_array is a constant and can - take the following values: MYSQL_ASSOC, - MYSQL_NUM, and MYSQL_BOTH. - This feature was added in PHP 3.0.7. MYSQL_BOTH - is the default for this argument. - - - By using MYSQL_BOTH, you'll get an array - with both associative and number indices. Using - MYSQL_ASSOC, you only get associative - indices (as mysql_fetch_assoc works), - using MYSQL_NUM, you only get number indices (as - mysql_fetch_row works). - - &database.field-case; - &database.fetch-null; - - <function>mysql_fetch_array</function> with - <constant>MYSQL_NUM</constant> - + <function>mysql_affected_array</function> with <constant>MYSQL_NUM</constant> + + - - <function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant> - + <function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant> + + - - <function>mysql_fetch_array</function> with <constant>MYSQL_BOTH</constant> - + <function>mysql_affected_array</function> with <constant>MYSQL_BOTH</constant> + + + + &reftitle.notes; + + Performance + + An important thing to note is that using + mysql_fetch_array 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_assoc, - mysql_data_seek and - mysql_query. + + mysql_fetch_row + mysql_fetch_assoc + mysql_data_seek + mysql_query +