mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Move to the new doc style.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183144 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
647c1d6f7b
commit
41473cf2d4
8 changed files with 481 additions and 210 deletions
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<refentry id="function.mysql-data-seek">
|
||||
<refnamediv>
|
||||
<refname>mysql_data_seek</refname>
|
||||
<refpurpose>Move internal result pointer</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysql_data_seek</methodname>
|
||||
<methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam>
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.23 -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry id="function.mysql-db-name">
|
||||
<refnamediv>
|
||||
<refname>mysql_db_name</refname>
|
||||
<refpurpose>Get result data</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysql_db_name</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
|
@ -15,18 +14,54 @@
|
|||
<methodparam choice="opt"><type>mixed</type><parameter>field</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>mysql_db_name</function> takes as its first parameter
|
||||
the result pointer from a call to
|
||||
<function>mysql_list_dbs</function>. The
|
||||
<parameter>row</parameter> parameter is an index into the result
|
||||
set.
|
||||
Retrieve the database name from a call to
|
||||
<function>mysql_list_dbs</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
If an error occurs, &false; is returned. Use
|
||||
<function>mysql_errno</function> and
|
||||
<function>mysql_error</function> to determine the nature of the
|
||||
error.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The result pointer from a call to <function>mysql_list_dbs</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The index into the result set.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The field name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the database name on success, and &false; on failure. If &false;
|
||||
is returned, use <function>mysql_error</function> to determine the nature
|
||||
of the error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_db_name</function> example</title>
|
||||
|
@ -49,14 +84,25 @@ while ($i < $cnt) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
For backward compatibility, <function>mysql_dbname</function> is
|
||||
also accepted. This is deprecated, however.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
For backward compatibility, <function>mysql_dbname</function> is
|
||||
also accepted. This is deprecated, however.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>mysql_list_dbs</function>, and
|
||||
<function>mysql_tablename</function>.
|
||||
<simplelist>
|
||||
<member><function>mysql_list_dbs</function></member>
|
||||
<member><function>mysql_tablename</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,49 +1,93 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry id="function.mysql-db-query">
|
||||
<refnamediv>
|
||||
<refname>mysql_db_query</refname>
|
||||
<refpurpose>Send a MySQL query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>resource</type><methodname>mysql_db_query</methodname>
|
||||
<methodparam><type>string</type><parameter>database</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>mysql_db_query</function> selects a database, and executes a
|
||||
query on it.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>database</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the database that will be selected.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The MySQL query.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>link_identifier</parameter></term>
|
||||
<listitem>
|
||||
&mysql.linkid.description;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns a positive MySQL result resource to the query result,
|
||||
or &false; on error. The function also returns &true;/&false; for
|
||||
<literal>INSERT</literal>/<literal>UPDATE</literal>/<literal>DELETE</literal>
|
||||
queries to indicate success/failure.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This function has been deprecated since PHP 4.0.6.
|
||||
Do not use this function. Use <function>mysql_select_db</function>
|
||||
and <function>mysql_query</function> instead.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<function>mysql_db_query</function> 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 <function>mysql_connect</function> was called with no
|
||||
arguments.
|
||||
</para>
|
||||
<para>
|
||||
Be aware that this function does <emphasis role="strong">NOT</emphasis>
|
||||
switch back to the database you were connected before. In other words,
|
||||
you can't use this function to <emphasis>temporarily</emphasis> run a
|
||||
sql query on another database, you would have to manually switch back.
|
||||
Users are strongly encouraged to use the
|
||||
<literal>database.table</literal> syntax in their sql queries or
|
||||
<function>mysql_select_db</function> instead of this function.
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>4.0.6</entry>
|
||||
<entry>
|
||||
This function is deprecated, do not use this function. Instead, use
|
||||
<function>mysql_select_db</function> and
|
||||
<function>mysql_query</function> instead.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_db_query</function> alternative example</title>
|
||||
|
@ -81,9 +125,30 @@ mysql_free_result($result);
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Be aware that this function does <emphasis role="strong">NOT</emphasis>
|
||||
switch back to the database you were connected before. In other words,
|
||||
you can't use this function to <emphasis>temporarily</emphasis> run a
|
||||
sql query on another database, you would have to manually switch back.
|
||||
Users are strongly encouraged to use the
|
||||
<literal>database.table</literal> syntax in their sql queries or
|
||||
<function>mysql_select_db</function> instead of this function.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
See also <function>mysql_connect</function> and
|
||||
<function>mysql_query</function>.
|
||||
<simplelist>
|
||||
<member><function>mysql_query</function></member>
|
||||
<member><function>mysql_select_db</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<refentry id="function.mysql-drop-db">
|
||||
<refnamediv>
|
||||
<refname>mysql_drop_db</refname>
|
||||
<refpurpose>Drop (delete) a MySQL database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysql_drop_db</methodname>
|
||||
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
|
||||
|
@ -16,22 +16,43 @@
|
|||
<para>
|
||||
<function>mysql_drop_db</function> 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
|
||||
<function>mysql_query</function> to issue a sql
|
||||
<literal>DROP DATABASE</literal> statement instead.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>database_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the database that will be deleted.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>link_identifier</parameter></term>
|
||||
<listitem>
|
||||
&mysql.linkid.description;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
<para>
|
||||
For downward compatibility <function>mysql_dropdb</function>
|
||||
can also be used. This is also deprecated, however.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The function <function>mysql_drop_db</function> is deprecated. It is
|
||||
preferable to use <function>mysql_query</function> to issue a sql
|
||||
<literal>DROP DATABASE</literal> statement instead.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_drop_db</function> alternative example</title>
|
||||
|
@ -54,14 +75,30 @@ if (mysql_query($sql, $link)) {
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<warning>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</warning>
|
||||
<note>
|
||||
<para>
|
||||
For downward compatibility <function>mysql_dropdb</function>
|
||||
can also be used. This is also deprecated, however.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
See also <function>mysql_query</function>.
|
||||
<simplelist>
|
||||
<member><function>mysql_query</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry id="function.mysql-errno">
|
||||
<refnamediv>
|
||||
<refname>mysql_errno</refname>
|
||||
<refpurpose>
|
||||
Returns the numerical value of the error message from previous
|
||||
MySQL operation
|
||||
</refpurpose>
|
||||
<refpurpose>Returns the numerical value of the error message from previous MySQL operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>mysql_errno</methodname>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the error number from the last MySQL function, or
|
||||
<literal>0</literal> (zero) if no error occurred.
|
||||
Returns the error number from the last MySQL function.
|
||||
</para>
|
||||
<para>
|
||||
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 <function>mysql_error</function> and
|
||||
<function>mysql_errno</function>), 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.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>link_identifier</parameter></term>
|
||||
<listitem>
|
||||
&mysql.linkid.description;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the error number from the last MySQL function, or
|
||||
<literal>0</literal> (zero) if no error occurred.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_errno</function> example</title>
|
||||
<programlisting role="php">
|
||||
|
@ -46,27 +70,24 @@ if (!mysql_query("SELECT * FROM nonexistenttable", $link)) {
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example would produce the following output:
|
||||
</para>
|
||||
<screen>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1049: Unknown database 'nonexistentdb'
|
||||
1146: Table 'kossu.nonexistenttable' doesn't exist
|
||||
]]>
|
||||
</screen>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
If the optional argument is specified the given link
|
||||
is used to retrieve the error code. If not, the last
|
||||
opened link is used.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
See also <function>mysql_error</function> and
|
||||
<ulink url="&url.mysql.docs.error;">MySQL error codes</ulink>.
|
||||
<simplelist>
|
||||
<member><function>mysql_error</function></member>
|
||||
<member><ulink url="&url.mysql.docs.error;">MySQL error codes</ulink></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,28 +1,19 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<refentry id="function.mysql-error">
|
||||
<refnamediv>
|
||||
<refname>mysql_error</refname>
|
||||
<refpurpose>
|
||||
Returns the text of the error message from previous MySQL
|
||||
operation
|
||||
</refpurpose>
|
||||
<refpurpose>Returns the text of the error message from previous MySQL operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysql_error</methodname>
|
||||
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns the error text from the last MySQL function, or
|
||||
<literal>''</literal> (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.
|
||||
</para>
|
||||
<para>
|
||||
Returns the error text from the last MySQL function.
|
||||
Errors coming back from the MySQL database backend no longer
|
||||
issue warnings. Instead, use <function>mysql_error</function> to
|
||||
retrieve the error text. Note that this function only returns the
|
||||
|
@ -30,6 +21,34 @@
|
|||
including <function>mysql_error</function> and
|
||||
<function>mysql_errno</function>), so if you want to use it, make
|
||||
sure you check the value before calling another MySQL function.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>link_identifier</parameter></term>
|
||||
<listitem>
|
||||
&mysql.linkid.description;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the error text from the last MySQL function, or
|
||||
<literal>''</literal> (empty string) if no error occurred.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_error</function> example</title>
|
||||
<programlisting role="php">
|
||||
|
@ -46,20 +65,24 @@ echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example would produce the following output:
|
||||
</para>
|
||||
<screen>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1049: Unknown database 'nonexistentdb'
|
||||
1146: Table 'kossu.nonexistenttable' doesn't exist
|
||||
]]>
|
||||
</screen>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
See also <function>mysql_errno</function> and
|
||||
<ulink url="&url.mysql.docs.error.msg;">MySQL error messages</ulink>.
|
||||
<simplelist>
|
||||
<member><function>mysql_errno</function></member>
|
||||
<member><ulink url="&url.mysql.docs.error;">MySQL error codes</ulink></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 -->
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<refentry id="function.mysql-escape-string">
|
||||
<refnamediv>
|
||||
<refname>mysql_escape_string</refname>
|
||||
<refpurpose>
|
||||
Escapes a string for use in a mysql_query
|
||||
</refpurpose>
|
||||
<refpurpose>Escapes a string for use in a mysql_query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysql_escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
|
||||
|
@ -17,20 +15,67 @@
|
|||
<para>
|
||||
This function will escape the <parameter>unescaped_string</parameter>,
|
||||
so that it is safe to place it in a <function>mysql_query</function>.
|
||||
This function is deprecated.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
<function>mysql_escape_string</function> does not escape
|
||||
<literal>%</literal> and <literal>_</literal>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
This function is identical to <function>mysql_real_escape_string</function> except that
|
||||
<function>mysql_real_escape_string</function> takes a connection handler and escapes the
|
||||
string according to the current character
|
||||
set. <function>mysql_escape_string</function> does not take a
|
||||
connection argument and does not respect the current charset setting.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
This function is identical to <function>mysql_real_escape_string</function>
|
||||
except that <function>mysql_real_escape_string</function> takes a
|
||||
connection handler and escapes the string according to the current
|
||||
character set. <function>mysql_escape_string</function> does not take a
|
||||
connection argument and does not respect the current charset setting.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>unescaped_string</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The string that is to be escaped.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the escaped string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>4.3.0</entry>
|
||||
<entry>
|
||||
This function became deprecated, do not use this function. Instead,
|
||||
use <function>mysql_real_escape_string</function>.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysql_escape_string</function> example</title>
|
||||
|
@ -43,9 +88,7 @@ printf("Escaped string: %s\n", $escaped_item);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example would produce the following output:
|
||||
</para>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Escaped string: Zak\'s Laptop
|
||||
|
@ -53,21 +96,26 @@ Escaped string: Zak\'s Laptop
|
|||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
<function>mysql_escape_string</function> does not escape
|
||||
<literal>%</literal> and <literal>_</literal>.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<note>
|
||||
<simpara>
|
||||
This function has been deprecated since PHP 4.3.0.
|
||||
Do not use this function. Use <function>mysql_real_escape_string</function>
|
||||
instead.
|
||||
</simpara>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<function>mysql_real_escape_string</function>,
|
||||
<function>addslashes</function> and the
|
||||
<link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>
|
||||
directive.
|
||||
<simplelist>
|
||||
<member><function>mysql_real_escape_string</function></member>
|
||||
<member><function>addslashes</function></member>
|
||||
<member>The <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> directive.</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,36 +1,74 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.20 $ -->
|
||||
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.27 -->
|
||||
<!-- $Revision: 1.21 $ -->
|
||||
<refentry id="function.mysql-fetch-array">
|
||||
<refnamediv>
|
||||
<refname>mysql_fetch_array</refname>
|
||||
<refpurpose>
|
||||
Fetch a result row as an associative array, a numeric array, or both
|
||||
</refpurpose>
|
||||
<refpurpose>Fetch a result row as an associative array, a numeric array, or both</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>mysql_fetch_array</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Returns an array that corresponds to the fetched row, or &false;
|
||||
if there are no more rows.</para>
|
||||
Returns an array that corresponds to the fetched row.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<function>mysql_fetch_array</function> is an extended version of
|
||||
<function>mysql_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.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The result that's being fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>result_type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The type of array that is to be fetched. It's a constant and can
|
||||
take the following values: <constant>MYSQL_ASSOC</constant>,
|
||||
<constant>MYSQL_NUM</constant>, and the default value of
|
||||
<constant>MYSQL_BOTH</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
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 <parameter>result_type</parameter> is defined. By using
|
||||
<constant>MYSQL_BOTH</constant> (default), you'll get an array with both
|
||||
associative and number indices. Using <constant>MYSQL_ASSOC</constant>, you
|
||||
only get associative indices (as <function>mysql_fetch_assoc</function>
|
||||
works), using <constant>MYSQL_NUM</constant>, you only get number indices
|
||||
(as <function>mysql_fetch_row</function> works).
|
||||
</para>
|
||||
<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 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
|
||||
<literal>'field'</literal> in this example).
|
||||
access the contents with the original column name.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Query with aliased duplicate field names</title>
|
||||
<programlisting role="sql">
|
||||
|
@ -40,37 +78,9 @@ SELECT table1.field AS foo, table2.field AS bar FROM table1, table2
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
An important thing to note is that using
|
||||
<function>mysql_fetch_array</function> is <emphasis>not
|
||||
significantly</emphasis> slower than using
|
||||
<function>mysql_fetch_row</function>, while it provides
|
||||
a significant added value.
|
||||
</para>
|
||||
<para>
|
||||
The optional second argument <parameter>result_type</parameter>
|
||||
in <function>mysql_fetch_array</function> is a constant and can
|
||||
take the following values: <constant>MYSQL_ASSOC</constant>,
|
||||
<constant>MYSQL_NUM</constant>, and <constant>MYSQL_BOTH</constant>.
|
||||
This feature was added in PHP 3.0.7. <constant>MYSQL_BOTH</constant>
|
||||
is the default for this argument.
|
||||
</para>
|
||||
<para>
|
||||
By using <constant>MYSQL_BOTH</constant>, you'll get an array
|
||||
with both associative and number indices. Using
|
||||
<constant>MYSQL_ASSOC</constant>, you only get associative
|
||||
indices (as <function>mysql_fetch_assoc</function> works),
|
||||
using <constant>MYSQL_NUM</constant>, you only get number indices (as
|
||||
<function>mysql_fetch_row</function> works).
|
||||
</para>
|
||||
&database.field-case;
|
||||
&database.fetch-null;
|
||||
<para>
|
||||
<example>
|
||||
<title>
|
||||
<function>mysql_fetch_array</function> with
|
||||
<constant>MYSQL_NUM</constant>
|
||||
</title>
|
||||
<title><function>mysql_affected_array</function> with <constant>MYSQL_NUM</constant></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -89,10 +99,10 @@ mysql_free_result($result);
|
|||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>
|
||||
<function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant>
|
||||
</title>
|
||||
<title><function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -111,10 +121,10 @@ mysql_free_result($result);
|
|||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>
|
||||
<function>mysql_fetch_array</function> with <constant>MYSQL_BOTH</constant>
|
||||
</title>
|
||||
<title><function>mysql_affected_array</function> with <constant>MYSQL_BOTH</constant></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@ -134,12 +144,33 @@ mysql_free_result($result);
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<title>Performance</title>
|
||||
<para>
|
||||
An important thing to note is that using
|
||||
<function>mysql_fetch_array</function> is <emphasis>not
|
||||
significantly</emphasis> slower than using
|
||||
<function>mysql_fetch_row</function>, while it provides
|
||||
a significant added value.
|
||||
</para>
|
||||
</note>
|
||||
&database.field-case;
|
||||
&database.fetch-null;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
See also
|
||||
<function>mysql_fetch_row</function>,
|
||||
<function>mysql_fetch_assoc</function>,
|
||||
<function>mysql_data_seek</function> and
|
||||
<function>mysql_query</function>.
|
||||
<simplelist>
|
||||
<member><function>mysql_fetch_row</function></member>
|
||||
<member><function>mysql_fetch_assoc</function></member>
|
||||
<member><function>mysql_data_seek</function></member>
|
||||
<member><function>mysql_query</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
Loading…
Reference in a new issue