WS. Flushed everything to the left, getting ready for the new doc style.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183137 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2005-03-30 04:07:29 +00:00
parent dc6fde3196
commit 68d0b4fb63
45 changed files with 2333 additions and 2333 deletions

View file

@ -1,62 +1,62 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.18 $ -->
<!-- $Revision: 1.19 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-affected-rows">
<refnamediv>
<refname>mysql_affected_rows</refname>
<refpurpose>Get number of affected rows in previous MySQL
operation</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_affected_rows</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_affected_rows</function> returns the number
of rows affected by the last INSERT, UPDATE or DELETE query
associated with <parameter>link_identifier</parameter>. If the
link identifier isn't specified, the last link opened by
<function>mysql_connect</function> is assumed.
</para>
<note>
<para>
If you are using transactions, you need to call
<function>mysql_affected_rows</function> after your INSERT,
UPDATE, or DELETE query, not after the commit.
</para>
</note>
<para>
If the last query was a DELETE query with no WHERE clause, all
of the records will have been deleted from the table but this
function will return zero with MySQL versions prior to 4.1.2.
</para>
<note>
<para>
When using UPDATE, MySQL will not update columns where the new
value is the same as the old value. This creates the possibility
that <function>mysql_affected_rows</function> may not actually
equal the number of rows matched, only the number of rows that
were literally affected by the query.
</para>
<para>
The REPLACE statement first deletes the record with the same primary key and
then inserts the new record. This function returns the number of deleted
records plus the number of inserted records.
</para>
</note>
<para>
To retrieve the number of rows returned by a SELECT, it is possible to
use also <function>mysql_num_rows</function>.
</para>
<para>
If the last query failed, this function will return -1.
<example>
<title>Delete-Query</title>
<programlisting role="php">
<refentry id="function.mysql-affected-rows">
<refnamediv>
<refname>mysql_affected_rows</refname>
<refpurpose>Get number of affected rows in previous MySQL
operation</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_affected_rows</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_affected_rows</function> returns the number
of rows affected by the last INSERT, UPDATE or DELETE query
associated with <parameter>link_identifier</parameter>. If the
link identifier isn't specified, the last link opened by
<function>mysql_connect</function> is assumed.
</para>
<note>
<para>
If you are using transactions, you need to call
<function>mysql_affected_rows</function> after your INSERT,
UPDATE, or DELETE query, not after the commit.
</para>
</note>
<para>
If the last query was a DELETE query with no WHERE clause, all
of the records will have been deleted from the table but this
function will return zero with MySQL versions prior to 4.1.2.
</para>
<note>
<para>
When using UPDATE, MySQL will not update columns where the new
value is the same as the old value. This creates the possibility
that <function>mysql_affected_rows</function> may not actually
equal the number of rows matched, only the number of rows that
were literally affected by the query.
</para>
<para>
The REPLACE statement first deletes the record with the same primary key and
then inserts the new record. This function returns the number of deleted
records plus the number of inserted records.
</para>
</note>
<para>
To retrieve the number of rows returned by a SELECT, it is possible to
use also <function>mysql_num_rows</function>.
</para>
<para>
If the last query failed, this function will return -1.
<example>
<title>Delete-Query</title>
<programlisting role="php">
<![CDATA[
<?php
/* connect to database */
@ -75,22 +75,22 @@ mysql_query('DELETE FROM mytable WHERE 0');
printf("Records deleted: %d\n", mysql_affected_rows());
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
Records deleted: 10
Records deleted: 0
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Update-Query</title>
<programlisting role="php">
</screen>
</example>
</para>
<para>
<example>
<title>Update-Query</title>
<programlisting role="php">
<![CDATA[
<?php
/* connect to database */
@ -104,23 +104,23 @@ printf ("Updated records: %d\n", mysql_affected_rows());
mysql_query("COMMIT");
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
Updated Records: 10
]]>
</screen>
</example>
</para>
<para>
See also <function>mysql_num_rows</function>, and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>mysql_num_rows</function>, and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-change-user">
<refnamediv>
<refname>mysql_change_user</refname>
<refpurpose>
Change logged in user of the active connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_change_user</methodname>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
database
</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_change_user</function> changes the logged in user
of the current active connection, or the connection given by the
optional <parameter>link_identifier</parameter> parameter. If a
database is specified, this will be the current database after
the user has been changed. If the new user and password
authorization fails, the current connected user stays active.
&return.success;
</para>
<refentry id="function.mysql-change-user">
<refnamediv>
<refname>mysql_change_user</refname>
<refpurpose>
Change logged in user of the active connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_change_user</methodname>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
database
</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_change_user</function> changes the logged in user
of the current active connection, or the connection given by the
optional <parameter>link_identifier</parameter> parameter. If a
database is specified, this will be the current database after
the user has been changed. If the new user and password
authorization fails, the current connected user stays active.
&return.success;
</para>
<note>
<para>
This deprecated function is only available in PHP 3 and requires MySQL
3.23.3 or higher.
</para>
</note>
</refsect1>
</refentry>
<note>
<para>
This deprecated function is only available in PHP 3 and requires MySQL
3.23.3 or higher.
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.100 -->
<refentry id="function.mysql-client-encoding">
<refnamediv>
<refname>mysql_client_encoding</refname>
<refpurpose>Returns the name of the character set</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_client_encoding</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_client_encoding</function> returns the default
character set name for the current connection.
</para>
<para>
<example>
<title><function>mysql_client_encoding</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-client-encoding">
<refnamediv>
<refname>mysql_client_encoding</refname>
<refpurpose>Returns the name of the character set</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_client_encoding</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_client_encoding</function> returns the default
character set name for the current connection.
</para>
<para>
<example>
<title><function>mysql_client_encoding</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -27,23 +27,23 @@ $charset = mysql_client_encoding($link);
printf("current character set is %s\n", $charset);
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
current character set is latin1
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_real_escape_string</function>
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_real_escape_string</function>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-close">
<refnamediv>
<refname>mysql_close</refname>
<refpurpose>Close MySQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_close</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
&return.success;
</para>
<para> <function>mysql_close</function> closes the connection to
the MySQL server that's associated with the specified link
identifier. If <parameter>link_identifier</parameter> isn't
specified, the last opened link is used.
</para>
<para>
Using <function>mysql_close</function> isn't usually necessary,
as non-persistent open links are automatically closed at the end
of the script's execution. See also
<link linkend="language.types.resource.self-destruct">freeing
resources</link>.
</para>
<note>
<para>
<function>mysql_close</function> will not close persistent links
created by <function>mysql_pconnect</function>.
</para>
</note>
<para>
<example>
<title><function>mysql_close</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-close">
<refnamediv>
<refname>mysql_close</refname>
<refpurpose>Close MySQL connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_close</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
&return.success;
</para>
<para> <function>mysql_close</function> closes the connection to
the MySQL server that's associated with the specified link
identifier. If <parameter>link_identifier</parameter> isn't
specified, the last opened link is used.
</para>
<para>
Using <function>mysql_close</function> isn't usually necessary,
as non-persistent open links are automatically closed at the end
of the script's execution. See also
<link linkend="language.types.resource.self-destruct">freeing
resources</link>.
</para>
<note>
<para>
<function>mysql_close</function> will not close persistent links
created by <function>mysql_pconnect</function>.
</para>
</note>
<para>
<example>
<title><function>mysql_close</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -49,15 +49,15 @@ echo 'Connected successfully';
mysql_close($link);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_connect</function> and
<function>mysql_pconnect</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_connect</function> and
<function>mysql_pconnect</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-create-db">
<refnamediv>
<refname>mysql_create_db</refname>
<refpurpose>Create a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_create_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_create_db</function> attempts to create a new
database on the server associated with the specified link
identifier.
</para>
<para>
&return.success;
</para>
<note>
<para>
The function <function>mysql_create_db</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a sql
<literal>CREATE DATABASE</literal> statement instead.
</para>
</note>
<para>
<example>
<title><function>mysql_create_db</function> alternative example</title>
<programlisting role="php">
<refentry id="function.mysql-create-db">
<refnamediv>
<refname>mysql_create_db</refname>
<refpurpose>Create a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_create_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_create_db</function> attempts to create a new
database on the server associated with the specified link
identifier.
</para>
<para>
&return.success;
</para>
<note>
<para>
The function <function>mysql_create_db</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a sql
<literal>CREATE DATABASE</literal> statement instead.
</para>
</note>
<para>
<example>
<title><function>mysql_create_db</function> alternative example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -49,24 +49,24 @@ if (mysql_query($sql, $link)) {
}
?>
]]>
</programlisting>
</example>
</para>
<para>
For downwards compatibility <function>mysql_createdb</function>
can also be used. This is deprecated, however.
</para>
<warning>
<para>
This function will not be available
if the MySQL extension was built against a MySQL 4.x client library.
</para>
</warning>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
For downwards compatibility <function>mysql_createdb</function>
can also be used. This is deprecated, however.
</para>
<warning>
<para>
This function will not be available
if the MySQL extension was built against a MySQL 4.x client library.
</para>
</warning>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,46 +1,46 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-data-seek">
<refnamediv>
<refname>mysql_data_seek</refname>
<refpurpose>Move internal result pointer</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_data_seek</methodname>
<methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_data_seek</function> moves the internal row
pointer of the MySQL result associated with the specified result
identifier to point to the specified row number. The next call
to <function>mysql_fetch_row</function> would return that row.
</para>
<para>
&return.success;
</para>
<para>
<parameter>row_number</parameter> starts at 0. The
<parameter>row_number</parameter> should be a value in the range from 0 to
<function>mysql_num_rows</function> - 1. However if the result set
is empty (<function>mysql_num_rows</function> == 0), a seek to 0 will
fail with a <link linkend="e-warning">E_WARNING</link> and
<function>mysql_data_seek</function> will return &false;.
</para>
<note>
<para>
The function <function>mysql_data_seek</function> can be used in
conjunction only with <function>mysql_query</function>, not with
<function>mysql_unbuffered_query</function>.
</para>
</note>
<para>
<example>
<title><function>mysql_data_seek</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-data-seek">
<refnamediv>
<refname>mysql_data_seek</refname>
<refpurpose>Move internal result pointer</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_data_seek</methodname>
<methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_data_seek</function> moves the internal row
pointer of the MySQL result associated with the specified result
identifier to point to the specified row number. The next call
to <function>mysql_fetch_row</function> would return that row.
</para>
<para>
&return.success;
</para>
<para>
<parameter>row_number</parameter> starts at 0. The
<parameter>row_number</parameter> should be a value in the range from 0 to
<function>mysql_num_rows</function> - 1. However if the result set
is empty (<function>mysql_num_rows</function> == 0), a seek to 0 will
fail with a <link linkend="e-warning">E_WARNING</link> and
<function>mysql_data_seek</function> will return &false;.
</para>
<note>
<para>
The function <function>mysql_data_seek</function> can be used in
conjunction only with <function>mysql_query</function>, not with
<function>mysql_unbuffered_query</function>.
</para>
</note>
<para>
<example>
<title><function>mysql_data_seek</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -73,20 +73,20 @@ for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_query</function>,
<function>mysql_num_rows</function>,
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_query</function>,
<function>mysql_num_rows</function>,
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.23 -->
<refentry id="function.mysql-db-name">
<refnamediv>
<refname>mysql_db_name</refname>
<refpurpose>Get result data</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_db_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<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.
</para>
<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.
</para>
<para>
<example>
<title><function>mysql_db_name</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-db-name">
<refnamediv>
<refname>mysql_db_name</refname>
<refpurpose>Get result data</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_db_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<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.
</para>
<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.
</para>
<para>
<example>
<title><function>mysql_db_name</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
error_reporting(E_ALL);
@ -48,20 +48,20 @@ while ($i < $cnt) {
}
?>
]]>
</programlisting>
</example>
</para>
<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>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<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>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,55 +1,55 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-db-query">
<refnamediv>
<refname>mysql_db_query</refname>
<refpurpose>Send a MySQL query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
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>
<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.
</para>
<para>
<example>
<title><function>mysql_db_query</function> alternative example</title>
<programlisting role="php">
<refentry id="function.mysql-db-query">
<refnamediv>
<refname>mysql_db_query</refname>
<refpurpose>Send a MySQL query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
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>
<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.
</para>
<para>
<example>
<title><function>mysql_db_query</function> alternative example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -80,15 +80,15 @@ mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_connect</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_connect</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-drop-db">
<refnamediv>
<refname>mysql_drop_db</refname>
<refpurpose>Drop (delete) a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_drop_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_drop_db</function> attempts to drop (remove) an
entire database from the server associated with the specified
link identifier.
</para>
<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>
<para>
<example>
<title><function>mysql_drop_db</function> alternative example</title>
<programlisting role="php">
<refentry id="function.mysql-drop-db">
<refnamediv>
<refname>mysql_drop_db</refname>
<refpurpose>Drop (delete) a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_drop_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_drop_db</function> attempts to drop (remove) an
entire database from the server associated with the specified
link identifier.
</para>
<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>
<para>
<example>
<title><function>mysql_drop_db</function> alternative example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -53,20 +53,20 @@ if (mysql_query($sql, $link)) {
}
?>
]]>
</programlisting>
</example>
</para>
<warning>
<para>
This function will not be available
if the MySQL extension was built against a MySQL 4.x client library.
</para>
</warning>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<warning>
<para>
This function will not be available
if the MySQL extension was built against a MySQL 4.x client library.
</para>
</warning>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-errno">
<refnamediv>
<refname>mysql_errno</refname>
<refpurpose>
Returns the numerical value of the error message from previous
MySQL operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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.
</para>
<para>
Errors coming back from the MySQL database backend no longer
issue warnings. Instead, use <function>mysql_errno</function> to
retrieve the error code. Note that this function only returns the
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.
<example>
<title><function>mysql_errno</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-errno">
<refnamediv>
<refname>mysql_errno</refname>
<refpurpose>
Returns the numerical value of the error message from previous
MySQL operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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.
</para>
<para>
Errors coming back from the MySQL database backend no longer
issue warnings. Instead, use <function>mysql_errno</function> to
retrieve the error code. Note that this function only returns the
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.
<example>
<title><function>mysql_errno</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
@ -47,31 +47,31 @@ if (!mysql_query("SELECT * FROM nonexistenttable", $link)) {
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
]]>
</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>
<para>
See also <function>mysql_error</function> and
<ulink url="&url.mysql.docs.error;">MySQL error codes</ulink>.
</para>
</refsect1>
</refentry>
</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>
<para>
See also <function>mysql_error</function> and
<ulink url="&url.mysql.docs.error;">MySQL error codes</ulink>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-error">
<refnamediv>
<refname>mysql_error</refname>
<refpurpose>
Returns the text of the error message from previous MySQL
operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
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
error text 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.
<example>
<title><function>mysql_error</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-error">
<refnamediv>
<refname>mysql_error</refname>
<refpurpose>
Returns the text of the error message from previous MySQL
operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
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
error text 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.
<example>
<title><function>mysql_error</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
@ -47,24 +47,24 @@ mysql_query("SELECT * FROM nonexistenttable", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
]]>
</screen>
</example>
</para>
<para>
See also <function>mysql_errno</function> and
<ulink url="&url.mysql.docs.error.msg;">MySQL error messages</ulink>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>mysql_errno</function> and
<ulink url="&url.mysql.docs.error.msg;">MySQL error messages</ulink>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 -->
<refentry id="function.mysql-escape-string">
<refnamediv>
<refname>mysql_escape_string</refname>
<refpurpose>
Escapes a string for use in a mysql_query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_escape_string</methodname>
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
</methodsynopsis>
<para>
This function will escape the <parameter>unescaped_string</parameter>,
so that it is safe to place it in a <function>mysql_query</function>.
</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>
<example>
<title><function>mysql_escape_string</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-escape-string">
<refnamediv>
<refname>mysql_escape_string</refname>
<refpurpose>
Escapes a string for use in a mysql_query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_escape_string</methodname>
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
</methodsynopsis>
<para>
This function will escape the <parameter>unescaped_string</parameter>,
so that it is safe to place it in a <function>mysql_query</function>.
</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>
<example>
<title><function>mysql_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$item = "Zak's Laptop";
@ -42,35 +42,35 @@ $escaped_item = mysql_escape_string($item);
printf("Escaped string: %s\n", $escaped_item);
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
Escaped string: Zak\'s Laptop
]]>
</screen>
</example>
</para>
<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.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<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.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,79 +1,79 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.18 $ -->
<!-- $Revision: 1.19 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.27 -->
<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>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
<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.
</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).
<example>
<title>Query with aliased duplicate field names</title>
<programlisting role="sql">
<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>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
<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.
</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).
<example>
<title>Query with aliased duplicate field names</title>
<programlisting role="sql">
<![CDATA[
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>
<programlisting role="php">
</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>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
@ -89,13 +89,13 @@ while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
<example>
<title>
<function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant>
</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>
<function>mysql_fetch_array</function> with <constant>MYSQL_ASSOC</constant>
</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
@ -111,13 +111,13 @@ while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
<example>
<title>
<function>mysql_fetch_array</function> with <constant>MYSQL_BOTH</constant>
</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>
<function>mysql_fetch_array</function> with <constant>MYSQL_BOTH</constant>
</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
@ -133,18 +133,18 @@ while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_data_seek</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_data_seek</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,52 +1,52 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.45 -->
<refentry id="function.mysql-fetch-assoc">
<refnamediv>
<refname>mysql_fetch_assoc</refname>
<refpurpose>
Fetch a result row as an associative array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative array that corresponds to the fetched row,
or &false; if there are no more rows.</para>
<para>
<function>mysql_fetch_assoc</function> is equivalent to calling
<function>mysql_fetch_array</function> with MYSQL_ASSOC for the
optional second parameter. It only returns an associative array.
This is the way <function>mysql_fetch_array</function> originally
worked. If you need the numeric indices as well as the
associative, use <function>mysql_fetch_array</function>.
</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 either need to access the
result with numeric indices by using
<function>mysql_fetch_row</function> or add alias names.
See the example at the <function>mysql_fetch_array</function>
description about aliases.
</para>
<para>
An important thing to note is that using
<function>mysql_fetch_assoc</function> is <emphasis>not
significantly</emphasis> slower than using
<function>mysql_fetch_row</function>, while it
provides a significant added value.
</para>
&database.field-case;
&database.fetch-null;
<para>
<example>
<title>An expanded <function>mysql_fetch_assoc</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-fetch-assoc">
<refnamediv>
<refname>mysql_fetch_assoc</refname>
<refpurpose>
Fetch a result row as an associative array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative array that corresponds to the fetched row,
or &false; if there are no more rows.</para>
<para>
<function>mysql_fetch_assoc</function> is equivalent to calling
<function>mysql_fetch_array</function> with MYSQL_ASSOC for the
optional second parameter. It only returns an associative array.
This is the way <function>mysql_fetch_array</function> originally
worked. If you need the numeric indices as well as the
associative, use <function>mysql_fetch_array</function>.
</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 either need to access the
result with numeric indices by using
<function>mysql_fetch_row</function> or add alias names.
See the example at the <function>mysql_fetch_array</function>
description about aliases.
</para>
<para>
An important thing to note is that using
<function>mysql_fetch_assoc</function> is <emphasis>not
significantly</emphasis> slower than using
<function>mysql_fetch_row</function>, while it
provides a significant added value.
</para>
&database.field-case;
&database.fetch-null;
<para>
<example>
<title>An expanded <function>mysql_fetch_assoc</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -56,7 +56,7 @@ if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("mydbname")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
@ -92,19 +92,19 @@ mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_row</function>,
<function>mysql_fetch_array</function>,
<function>mysql_data_seek</function>,
<function>mysql_query</function> and
<function>mysql_error</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_row</function>,
<function>mysql_fetch_array</function>,
<function>mysql_data_seek</function>,
<function>mysql_query</function> and
<function>mysql_error</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,101 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-field">
<refnamediv>
<refname>mysql_fetch_field</refname>
<refpurpose>
Get column information from a result and return as an object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>mysql_fetch_field</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
field_offset
</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object containing field information.
</para>
<para>
<function>mysql_fetch_field</function> 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 <function>mysql_fetch_field</function> is retrieved.
</para>
<para>
The properties of the object are:
<itemizedlist>
<listitem>
<simpara>
name - column name
</simpara>
</listitem>
<listitem>
<simpara>
table - name of the table the column belongs to
</simpara>
</listitem>
<listitem>
<simpara>
max_length - maximum length of the column
</simpara>
</listitem>
<listitem>
<simpara>
not_null - 1 if the column cannot be &null;
</simpara>
</listitem>
<listitem>
<simpara>
primary_key - 1 if the column is a primary key
</simpara>
</listitem>
<listitem>
<simpara>
unique_key - 1 if the column is a unique key
</simpara>
</listitem>
<listitem>
<simpara>
multiple_key - 1 if the column is a non-unique key
</simpara>
</listitem>
<listitem>
<simpara>
numeric - 1 if the column is numeric
</simpara>
</listitem>
<listitem>
<simpara>
blob - 1 if the column is a BLOB
</simpara>
</listitem>
<listitem>
<simpara>
type - the type of the column
</simpara>
</listitem>
<listitem>
<simpara>
unsigned - 1 if the column is unsigned
</simpara>
</listitem>
<listitem>
<simpara>
zerofill - 1 if the column is zero-filled
</simpara>
</listitem>
</itemizedlist>
</para>
&database.field-case;
<para>
<example>
<title><function>mysql_fetch_field</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-fetch-field">
<refnamediv>
<refname>mysql_fetch_field</refname>
<refpurpose>
Get column information from a result and return as an object
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>mysql_fetch_field</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
field_offset
</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object containing field information.
</para>
<para>
<function>mysql_fetch_field</function> 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 <function>mysql_fetch_field</function> is retrieved.
</para>
<para>
The properties of the object are:
<itemizedlist>
<listitem>
<simpara>
name - column name
</simpara>
</listitem>
<listitem>
<simpara>
table - name of the table the column belongs to
</simpara>
</listitem>
<listitem>
<simpara>
max_length - maximum length of the column
</simpara>
</listitem>
<listitem>
<simpara>
not_null - 1 if the column cannot be &null;
</simpara>
</listitem>
<listitem>
<simpara>
primary_key - 1 if the column is a primary key
</simpara>
</listitem>
<listitem>
<simpara>
unique_key - 1 if the column is a unique key
</simpara>
</listitem>
<listitem>
<simpara>
multiple_key - 1 if the column is a non-unique key
</simpara>
</listitem>
<listitem>
<simpara>
numeric - 1 if the column is numeric
</simpara>
</listitem>
<listitem>
<simpara>
blob - 1 if the column is a BLOB
</simpara>
</listitem>
<listitem>
<simpara>
type - the type of the column
</simpara>
</listitem>
<listitem>
<simpara>
unsigned - 1 if the column is unsigned
</simpara>
</listitem>
<listitem>
<simpara>
zerofill - 1 if the column is zero-filled
</simpara>
</listitem>
</itemizedlist>
</para>
&database.field-case;
<para>
<example>
<title><function>mysql_fetch_field</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = mysql_connect('localhost:3306', 'user', 'password');
@ -134,14 +134,14 @@ zerofill: $meta->zerofill
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_field_seek</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>mysql_field_seek</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-lengths">
<refnamediv>
<refname>mysql_fetch_lengths</refname>
<refpurpose>
Get the length of each output in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_lengths</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the lengths of each field
in the last row fetched by <function>mysql_fetch_row</function>,
or &false; on error.
</para>
<para>
<function>mysql_fetch_lengths</function> stores the lengths of
each result column in the last row returned by
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function> in an array, starting at
offset 0.
</para>
<para>
<example>
<title>A <function>mysql_fetch_lengths</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-fetch-lengths">
<refnamediv>
<refname>mysql_fetch_lengths</refname>
<refpurpose>
Get the length of each output in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_lengths</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the lengths of each field
in the last row fetched by <function>mysql_fetch_row</function>,
or &false; on error.
</para>
<para>
<function>mysql_fetch_lengths</function> stores the lengths of
each result column in the last row returned by
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function> in an array, starting at
offset 0.
</para>
<para>
<example>
<title>A <function>mysql_fetch_lengths</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -46,9 +46,9 @@ print_r($row);
print_r($lengths);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@ -61,16 +61,16 @@ Array
[1] => 16
)
]]>
</screen>
</example>
</para>
<para>
See also <function>mysql_field_len</function>,
<function>mysql_fetch_row</function>, and
<function>strlen</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>mysql_field_len</function>,
<function>mysql_fetch_row</function>, and
<function>strlen</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-object">
<refnamediv>
<refname>mysql_fetch_object</refname>
<refpurpose>Fetch a result row as an object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>mysql_fetch_object</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object with properties that correspond to the fetched
row, or &false; if there are no more rows.
</para>
<para>
<function>mysql_fetch_object</function> is similar to
<function>mysql_fetch_array</function>, 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).
</para>
&database.field-case;
&database.fetch-null;
<para>
<example>
<title><function>mysql_fetch_object</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-fetch-object">
<refnamediv>
<refname>mysql_fetch_object</refname>
<refpurpose>Fetch a result row as an object</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>mysql_fetch_object</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object with properties that correspond to the fetched
row, or &false; if there are no more rows.
</para>
<para>
<function>mysql_fetch_object</function> is similar to
<function>mysql_fetch_array</function>, 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).
</para>
&database.field-case;
&database.fetch-null;
<para>
<example>
<title><function>mysql_fetch_object</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -41,17 +41,17 @@ echo $row->field;
?>
]]>
</programlisting>
</example>
</para>
<para>
Speed-wise, the function is identical to
<function>mysql_fetch_array</function>, and almost as quick as
<function>mysql_fetch_row</function> (the difference is
insignificant).
<example>
<title><function>mysql_fetch_object</function> example</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
Speed-wise, the function is identical to
<function>mysql_fetch_array</function>, and almost as quick as
<function>mysql_fetch_row</function> (the difference is
insignificant).
<example>
<title><function>mysql_fetch_object</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("hostname", "user", "password");
@ -64,19 +64,19 @@ while ($row = mysql_fetch_object($result)) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_row</function>,
<function>mysql_data_seek</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_row</function>,
<function>mysql_data_seek</function> and
<function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-fetch-row">
<refnamediv>
<refname>mysql_fetch_row</refname>
<refpurpose>Get a result row as an enumerated array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
&database.fetch-null;
<para>
<function>mysql_fetch_row</function> 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.
</para>
<para>
Subsequent call to <function>mysql_fetch_row</function> would
return the next row in the result set, or &false; if there are no
more rows.
</para>
<para>
<example>
<title>Fetching one row with <function>mysql_fetch_row</function></title>
<programlisting role="php">
<refentry id="function.mysql-fetch-row">
<refnamediv>
<refname>mysql_fetch_row</refname>
<refpurpose>Get a result row as an enumerated array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>mysql_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
&database.fetch-null;
<para>
<function>mysql_fetch_row</function> 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.
</para>
<para>
Subsequent call to <function>mysql_fetch_row</function> would
return the next row in the result set, or &false; if there are no
more rows.
</para>
<para>
<example>
<title>Fetching one row with <function>mysql_fetch_row</function></title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -45,20 +45,20 @@ echo $row[0]; // 42
echo $row[1]; // the email value
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_object</function>,
<function>mysql_data_seek</function>,
<function>mysql_fetch_lengths</function> and
<function>mysql_result</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_object</function>,
<function>mysql_data_seek</function>,
<function>mysql_fetch_lengths</function> and
<function>mysql_result</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.17 -->
<refentry id="function.mysql-field-flags">
<refnamediv>
<refname>mysql_field_flags</refname>
<refpurpose>
Get the flags associated with the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_flags</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_flags</function> returns the field flags of
the specified field. The flags are reported as a single word
per flag separated by a single space, so that you can split the
returned value using <function>explode</function>.
</para>
<para>The following flags are reported, if your version of MySQL
is current enough to support them: <literal>"not_null"</literal>,
<literal>"primary_key"</literal>, <literal>"unique_key"</literal>,
<literal>"multiple_key"</literal>, <literal>"blob"</literal>,
<literal>"unsigned"</literal>, <literal>"zerofill"</literal>,
<literal>"binary"</literal>, <literal>"enum"</literal>,
<literal>"auto_increment"</literal> et <literal>"timestamp"</literal>.
</para>
<para>
<example>
<title>A <function>mysql_field_flags</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-field-flags">
<refnamediv>
<refname>mysql_field_flags</refname>
<refpurpose>
Get the flags associated with the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_flags</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_flags</function> returns the field flags of
the specified field. The flags are reported as a single word
per flag separated by a single space, so that you can split the
returned value using <function>explode</function>.
</para>
<para>The following flags are reported, if your version of MySQL
is current enough to support them: <literal>"not_null"</literal>,
<literal>"primary_key"</literal>, <literal>"unique_key"</literal>,
<literal>"multiple_key"</literal>, <literal>"blob"</literal>,
<literal>"unsigned"</literal>, <literal>"zerofill"</literal>,
<literal>"binary"</literal>, <literal>"enum"</literal>,
<literal>"auto_increment"</literal> et <literal>"timestamp"</literal>.
</para>
<para>
<example>
<title>A <function>mysql_field_flags</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -46,9 +46,9 @@ echo $flags;
print_r(explode(' ', $flags));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
not_null primary_key auto_increment
Array
@ -58,15 +58,15 @@ Array
[2] => auto_increment
)
]]>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldflags</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldflags</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.17 -->
<refentry id="function.mysql-field-len">
<refnamediv>
<refname>mysql_field_len</refname>
<refpurpose>
Returns the length of the specified field
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_field_len</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_len</function> returns the length of the
specified field.
</para>
<para>
<example>
<title><function>mysql_field_len</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-field-len">
<refnamediv>
<refname>mysql_field_len</refname>
<refpurpose>
Returns the length of the specified field
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_field_len</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_len</function> returns the length of the
specified field.
</para>
<para>
<example>
<title><function>mysql_field_len</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -37,19 +37,19 @@ $length = mysql_field_len($result, 'email');
echo $length;
?>
]]>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldlen</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_fetch_lengths</function> and
<function>strlen</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldlen</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_fetch_lengths</function> and
<function>strlen</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-field-name">
<refnamediv>
<refname>mysql_field_name</refname>
<refpurpose>
Get the name of the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_index</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_name</function> returns the name of the
specified field index. <parameter>result</parameter> must be a
valid result identifier and <parameter>field_index</parameter> is
the numerical offset of the field.
</para>
<note>
<para>
<parameter>field_index</parameter> starts at 0.
</para>
<para>
e.g. The index of the third field would actually be 2, the index
of the fourth field would be 3 and so on.
</para>
</note>
&database.field-case;
<para>
<example>
<title><function>mysql_field_name</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-field-name">
<refnamediv>
<refname>mysql_field_name</refname>
<refpurpose>
Get the name of the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_index</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_name</function> returns the name of the
specified field index. <parameter>result</parameter> must be a
valid result identifier and <parameter>field_index</parameter> is
the numerical offset of the field.
</para>
<note>
<para>
<parameter>field_index</parameter> starts at 0.
</para>
<para>
e.g. The index of the third field would actually be 2, the index
of the fourth field would be 3 and so on.
</para>
</note>
&database.field-case;
<para>
<example>
<title><function>mysql_field_name</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* The users table consists of three fields:
* user_id
* username
* password.
*/
* user_id
* username
* password.
*/
$link = @mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect to MySQL server: ' . mysql_error());
@ -57,24 +57,24 @@ echo mysql_field_name($res, 0) . "\n";
echo mysql_field_name($res, 2);
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
user_id
password
]]>
</screen>
</example>
</para>
<para>
For downwards compatibility <function>mysql_fieldname</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
For downwards compatibility <function>mysql_fieldname</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-field-seek">
<refnamediv>
<refname>mysql_field_seek</refname>
<refpurpose>
Set result pointer to a specified field offset
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_field_seek</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Seeks to the specified field offset. If the next call to
<function>mysql_fetch_field</function> doesn't include a field
offset, the field offset specified in
<function>mysql_field_seek</function> will be returned.
</para>
<para>
See also <function>mysql_fetch_field</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-field-seek">
<refnamediv>
<refname>mysql_field_seek</refname>
<refpurpose>
Set result pointer to a specified field offset
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_field_seek</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Seeks to the specified field offset. If the next call to
<function>mysql_fetch_field</function> doesn't include a field
offset, the field offset specified in
<function>mysql_field_seek</function> will be returned.
</para>
<para>
See also <function>mysql_fetch_field</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-field-table">
<refnamediv>
<refname>mysql_field_table</refname>
<refpurpose>
Get name of the table the specified field is in
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_table</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Returns the name of the table that the specified field is
in.
</para>
<para>
<example>
<title>A <function>mysql_field_table</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-field-table">
<refnamediv>
<refname>mysql_field_table</refname>
<refpurpose>
Get name of the table the specified field is in
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_table</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Returns the name of the table that the specified field is
in.
</para>
<para>
<example>
<title>A <function>mysql_field_table</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT name,comment FROM people,comments");
@ -36,18 +36,18 @@ $table = mysql_field_table($result, 'name');
echo $table; // people
?>
]]>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldtable</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_list_tables</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldtable</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_list_tables</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-field-type">
<refnamediv>
<refname>mysql_field_type</refname>
<refpurpose>
Get the type of the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_type</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_type</function> is similar to the
<function>mysql_field_name</function> function. The arguments are
identical, but the field type is returned instead. The field type
will be one of <literal>"int"</literal>, <literal>"real"</literal>,
<literal>"string"</literal>, <literal>"blob"</literal>, and others as
detailed in the <ulink url="&url.mysql.docs;">MySQL
documentation</ulink>.
<example>
<title><function>mysql_field_type</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-field-type">
<refnamediv>
<refname>mysql_field_type</refname>
<refpurpose>
Get the type of the specified field in a result
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_field_type</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_field_type</function> is similar to the
<function>mysql_field_name</function> function. The arguments are
identical, but the field type is returned instead. The field type
will be one of <literal>"int"</literal>, <literal>"real"</literal>,
<literal>"string"</literal>, <literal>"blob"</literal>, and others as
detailed in the <ulink url="&url.mysql.docs;">MySQL
documentation</ulink>.
<example>
<title><function>mysql_field_type</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_username", "mysql_password");
@ -33,7 +33,7 @@ mysql_select_db("mysql");
$result = mysql_query("SELECT * FROM func");
$fields = mysql_num_fields($result);
$rows = mysql_num_rows($result);
$table = mysql_field_table($result, 0);
$table = mysql_field_table($result, 0);
echo "Your '" . $table . "' table has " . $fields . " fields and " . $rows . " record(s)\n";
echo "The table has the following fields:\n";
for ($i=0; $i < $fields; $i++) {
@ -47,11 +47,11 @@ mysql_free_result($result);
mysql_close();
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
Your 'func' table has 4 fields and 1 record(s)
The table has the following fields:
@ -60,15 +60,15 @@ int ret 1 not_null
string dl 128 not_null
string type 9 not_null enum
]]>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldtype</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_fieldtype</function>
can also be used. This is deprecated, however.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.102 -->
<refentry id="function.mysql-free-result">
<refnamediv>
<refname>mysql_free_result</refname>
<refpurpose>Free result memory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_free_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_free_result</function> will free all memory
associated with the result identifier <parameter>result</parameter>.
</para>
<para>
<function>mysql_free_result</function> only needs to be called if
you are concerned about how much memory is being used for queries
that return large result sets. All associated result memory is
automatically freed at the end of the script's execution.
</para>
<para>
&return.success;
</para>
<para>
If a non-resource is used for the <parameter>result</parameter>, an
error of level E_WARNING will be emitted. It's worth noting that
<function>mysql_query</function> only returns a <type>resource</type>
for SELECT, SHOW, EXPLAIN, and DESCRIBE queries.
</para>
<para>
<example>
<title>A <function>mysql_free_result</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-free-result">
<refnamediv>
<refname>mysql_free_result</refname>
<refpurpose>Free result memory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_free_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_free_result</function> will free all memory
associated with the result identifier <parameter>result</parameter>.
</para>
<para>
<function>mysql_free_result</function> only needs to be called if
you are concerned about how much memory is being used for queries
that return large result sets. All associated result memory is
automatically freed at the end of the script's execution.
</para>
<para>
&return.success;
</para>
<para>
If a non-resource is used for the <parameter>result</parameter>, an
error of level E_WARNING will be emitted. It's worth noting that
<function>mysql_query</function> only returns a <type>resource</type>
for SELECT, SHOW, EXPLAIN, and DESCRIBE queries.
</para>
<para>
<example>
<title>A <function>mysql_free_result</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -52,19 +52,19 @@ echo $row['id'];
echo $row['email'];
?>
]]>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_freeresult</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_query</function> and
<function>is_resource</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_freeresult</function>
can also be used. This is deprecated, however.
</para>
<para>
See also <function>mysql_query</function> and
<function>is_resource</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 -->
<refentry id="function.mysql-get-client-info">
<refnamediv>
<refname>mysql_get_client_info</refname>
<refpurpose>Get MySQL client info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_client_info</methodname>
<void/>
</methodsynopsis>
<para>
<function>mysql_get_client_info</function> returns a string that
represents the client library version.
</para>
<para>
<example>
<title><function>mysql_get_client_info</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-get-client-info">
<refnamediv>
<refname>mysql_get_client_info</refname>
<refpurpose>Get MySQL client info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_client_info</methodname>
<void/>
</methodsynopsis>
<para>
<function>mysql_get_client_info</function> returns a string that
represents the client library version.
</para>
<para>
<example>
<title><function>mysql_get_client_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
printf("MySQL client info: %s\n", mysql_get_client_info());
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
MySQL client info: 3.23.39
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_host_info</function>,
<function>mysql_get_proto_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_host_info</function>,
<function>mysql_get_proto_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 -->
<refentry id="function.mysql-get-host-info">
<refnamediv>
<refname>mysql_get_host_info</refname>
<refpurpose>Get MySQL host info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_host_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_host_info</function> returns a string
describing the type of connection in use for the connection
<parameter>link_identifier</parameter>, including the server host
name. If <parameter>link_identifier</parameter> is omitted, the
last opened connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_host_info</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-get-host-info">
<refnamediv>
<refname>mysql_get_host_info</refname>
<refpurpose>Get MySQL host info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_host_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_host_info</function> returns a string
describing the type of connection in use for the connection
<parameter>link_identifier</parameter>, including the server host
name. If <parameter>link_identifier</parameter> is omitted, the
last opened connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_host_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -32,25 +32,25 @@ if (!$link) {
printf("MySQL host info: %s\n", mysql_get_host_info());
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
MySQL host info: Localhost via UNIX socket
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_proto_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_proto_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.62 -->
<refentry id="function.mysql-get-proto-info">
<refnamediv>
<refname>mysql_get_proto_info</refname>
<refpurpose>Get MySQL protocol info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_get_proto_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_proto_info</function> returns the protocol
version used by connection
<parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> is omitted, the last opened
connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_proto_info</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-get-proto-info">
<refnamediv>
<refname>mysql_get_proto_info</refname>
<refpurpose>Get MySQL protocol info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_get_proto_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_proto_info</function> returns the protocol
version used by connection
<parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> is omitted, the last opened
connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_proto_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -32,25 +32,25 @@ if (!$link) {
printf("MySQL protocol version: %s\n", mysql_get_proto_info());
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
MySQL protocol version: 10
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_host_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_host_info</function> and
<function>mysql_get_server_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.96 -->
<refentry id="function.mysql-get-server-info">
<refnamediv>
<refname>mysql_get_server_info</refname>
<refpurpose>Get MySQL server info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_server_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_server_info</function> returns the server
version used by connection
<parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> is omitted, the last opened
connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_server_info</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-get-server-info">
<refnamediv>
<refname>mysql_get_server_info</refname>
<refpurpose>Get MySQL server info</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_get_server_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_get_server_info</function> returns the server
version used by connection
<parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> is omitted, the last opened
connection will be used.
</para>
<para>
<example>
<title><function>mysql_get_server_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -32,26 +32,26 @@ if (!$link) {
printf("MySQL server version: %s\n", mysql_get_server_info());
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
MySQL server version: 4.0.1-alpha
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_host_info</function>,
<function>mysql_get_proto_info</function>, and
<function>phpversion</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_get_client_info</function>,
<function>mysql_get_host_info</function>,
<function>mysql_get_proto_info</function>, and
<function>phpversion</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-info">
<refnamediv>
<refname>mysql_info</refname>
<refpurpose>
Get information about the most recent query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_info</function> returns detailed information about
the last query using the given <parameter>link_identifier</parameter>.
If <parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed.
</para>
<para>
<function>mysql_info</function> returns a string for all statements
listed below. For everything else, it returns &false;. The string
format depends on the given statement.
<example>
<title>Relevant MySQL Statements</title>
<programlisting role="mysql">
<refentry id="function.mysql-info">
<refnamediv>
<refname>mysql_info</refname>
<refpurpose>
Get information about the most recent query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_info</function> returns detailed information about
the last query using the given <parameter>link_identifier</parameter>.
If <parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed.
</para>
<para>
<function>mysql_info</function> returns a string for all statements
listed below. For everything else, it returns &false;. The string
format depends on the given statement.
<example>
<title>Relevant MySQL Statements</title>
<programlisting role="mysql">
<![CDATA[
INSERT INTO ... SELECT ...
String format: Records: 23 Duplicates: 0 Warnings: 0
@ -41,26 +41,26 @@ String format: Records: 60 Duplicates: 0 Warnings: 0
UPDATE
String format: Rows matched: 65 Changed: 65 Warnings: 0
]]>
</programlisting>
</example>
The numbers are only for illustrating purpose; their values will
correspond to the query.
</para>
<note>
<para>
<function>mysql_info</function> returns a non-&false; value for the
INSERT ... VALUES statement only if multiple value lists are
specified in the statement.
</para>
</note>
<para>
See also
<function>mysql_affected_rows</function>,
<function>mysql_insert_id</function>, and
<function>mysql_stat</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
The numbers are only for illustrating purpose; their values will
correspond to the query.
</para>
<note>
<para>
<function>mysql_info</function> returns a non-&false; value for the
INSERT ... VALUES statement only if multiple value lists are
specified in the statement.
</para>
</note>
<para>
See also
<function>mysql_affected_rows</function>,
<function>mysql_insert_id</function>, and
<function>mysql_stat</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,59 +1,59 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-insert-id">
<refnamediv>
<refname>mysql_insert_id</refname>
<refpurpose>
Get the ID generated from the previous INSERT operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_insert_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_insert_id</function> returns the ID generated for
an AUTO_INCREMENT column by the previous INSERT query using the
given <parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed.
</para>
<para>
<function>mysql_insert_id</function> 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
<function>mysql_insert_id</function> immediately after the
query that generates the value.
</para>
<note>
<para>
The value of the MySQL SQL function
<literal>LAST_INSERT_ID()</literal> always contains the most
recently generated AUTO_INCREMENT value, and is not reset
between queries.
</para>
</note>
<warning>
<para>
<function>mysql_insert_id</function> converts the return type of
the native MySQL C API function
<literal>mysql_insert_id()</literal> to a type of
<literal>long</literal> (named <type>int</type> in PHP).
If your AUTO_INCREMENT column has a column type of BIGINT,
the value returned by <function>mysql_insert_id</function>
will be incorrect. Instead, use the internal MySQL SQL function
<literal>LAST_INSERT_ID()</literal> in an SQL query.
</para>
</warning>
<para>
<example>
<title><function>mysql_insert_id</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-insert-id">
<refnamediv>
<refname>mysql_insert_id</refname>
<refpurpose>
Get the ID generated from the previous INSERT operation
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_insert_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_insert_id</function> returns the ID generated for
an AUTO_INCREMENT column by the previous INSERT query using the
given <parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed.
</para>
<para>
<function>mysql_insert_id</function> 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
<function>mysql_insert_id</function> immediately after the
query that generates the value.
</para>
<note>
<para>
The value of the MySQL SQL function
<literal>LAST_INSERT_ID()</literal> always contains the most
recently generated AUTO_INCREMENT value, and is not reset
between queries.
</para>
</note>
<warning>
<para>
<function>mysql_insert_id</function> converts the return type of
the native MySQL C API function
<literal>mysql_insert_id()</literal> to a type of
<literal>long</literal> (named <type>int</type> in PHP).
If your AUTO_INCREMENT column has a column type of BIGINT,
the value returned by <function>mysql_insert_id</function>
will be incorrect. Instead, use the internal MySQL SQL function
<literal>LAST_INSERT_ID()</literal> in an SQL query.
</para>
</warning>
<para>
<example>
<title><function>mysql_insert_id</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -66,16 +66,16 @@ mysql_query("INSERT INTO mytable (product) values ('kossu')");
printf("Last inserted record has id %d\n", mysql_insert_id());
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_query</function> and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_query</function> and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,73 +1,73 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.16 -->
<refentry id="function.mysql-list-dbs">
<refnamediv>
<refname>mysql_list_dbs</refname>
<refpurpose>
List databases available on a MySQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_dbs</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_dbs</function> will return a result pointer
containing the databases available from the current mysql
daemon. Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
</para>
<para>
<example>
<title><function>mysql_list_dbs</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-list-dbs">
<refnamediv>
<refname>mysql_list_dbs</refname>
<refpurpose>
List databases available on a MySQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_dbs</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_dbs</function> will return a result pointer
containing the databases available from the current mysql
daemon. Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
</para>
<para>
<example>
<title><function>mysql_list_dbs</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$db_list = mysql_list_dbs($link);
while ($row = mysql_fetch_object($db_list)) {
echo $row->Database . "\n";
echo $row->Database . "\n";
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
database1
database2
database3
...
]]>
</screen>
</example>
</para>
<note>
<para>
The above code would just as easily work with
<function>mysql_fetch_row</function> or other similar functions.
</para>
</note>
<para>
For downward compatibility <function>mysql_listdbs</function> can
also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_db_name</function>, and
<function>mysql_select_db</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<note>
<para>
The above code would just as easily work with
<function>mysql_fetch_row</function> or other similar functions.
</para>
</note>
<para>
For downward compatibility <function>mysql_listdbs</function> can
also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_db_name</function>, and
<function>mysql_select_db</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-list-fields">
<refnamediv>
<refname>mysql_list_fields</refname>
<refpurpose>List MySQL table fields</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_fields</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<note>
<para>
The function <function>mysql_list_fields</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a
SQL <literal>SHOW COLUMNS FROM table [LIKE 'name']</literal> Statement instead.
</para>
</note>
<para>
<function>mysql_list_fields</function> 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 <function>mysql_field_flags</function>,
<function>mysql_field_len</function>,
<function>mysql_field_name</function>, and
<function>mysql_field_type</function>.
</para>
<para>
<example>
<title>Alternate to deprecated <function>mysql_list_fields</function></title>
<programlisting role="php">
<refentry id="function.mysql-list-fields">
<refnamediv>
<refname>mysql_list_fields</refname>
<refpurpose>List MySQL table fields</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_fields</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<note>
<para>
The function <function>mysql_list_fields</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a
SQL <literal>SHOW COLUMNS FROM table [LIKE 'name']</literal> Statement instead.
</para>
</note>
<para>
<function>mysql_list_fields</function> 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 <function>mysql_field_flags</function>,
<function>mysql_field_len</function>,
<function>mysql_field_name</function>, and
<function>mysql_field_type</function>.
</para>
<para>
<example>
<title>Alternate to deprecated <function>mysql_list_fields</function></title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SHOW COLUMNS FROM sometable");
@ -50,17 +50,17 @@ if (mysql_num_rows($result) > 0) {
}
?>
]]>
</programlisting>
<para>
The above example would produce output similar to:
</para>
<screen>
</programlisting>
<para>
The above example would produce output similar to:
</para>
<screen>
<![CDATA[
Array
(
[Field] => id
[Type] => int(7)
[Null] =>
[Null] =>
[Key] => PRI
[Default] =>
[Extra] => auto_increment
@ -75,20 +75,20 @@ Array
[Extra] =>
)
]]>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_listfields</function>
can also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_field_flags</function> and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
For downward compatibility <function>mysql_listfields</function>
can also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_field_flags</function> and
<function>mysql_info</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.96 -->
<refentry id="function.mysql-list-processes">
<refnamediv>
<refname>mysql_list_processes</refname>
<refpurpose>List MySQL processes</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_processes</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_processes</function> returns a result pointer
describing the current server threads.
</para>
<para>
<example>
<title><function>mysql_list_processes</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-list-processes">
<refnamediv>
<refname>mysql_list_processes</refname>
<refpurpose>List MySQL processes</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_processes</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_processes</function> returns a result pointer
describing the current server threads.
</para>
<para>
<example>
<title><function>mysql_list_processes</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -29,30 +29,30 @@ $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$result = mysql_list_processes($link);
while ($row = mysql_fetch_assoc($result)){
printf("%s %s %s %s %s\n", $row["Id"], $row["Host"], $row["db"],
$row["Command"], $row["Time"]);
$row["Command"], $row["Time"]);
}
mysql_free_result($result);
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
1 localhost test Processlist 0
4 localhost mysql sleep 5
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_thread_id</function> and
<function>mysql_stat</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_thread_id</function> and
<function>mysql_stat</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-list-tables">
<refnamediv>
<refname>mysql_list_tables</refname>
<refpurpose>List tables in a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_tables</methodname>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_tables</function> takes a database name and
returns a result pointer much like the
<function>mysql_query</function> function.
Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
</para>
<para>
The <parameter>database</parameter> parameter is the name of the
database to retrieve the list of tables from. Upon failure,
<function>mysql_list_tables</function> returns &false;.
</para>
<para>
For downward compatibility, the function alias named
<function>mysql_listtables</function> can be used. This is
deprecated however and is not recommended.
</para>
<note>
<para>
The function <function>mysql_list_tables</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a
SQL <literal>SHOW TABLES [FROM db_name] [LIKE 'pattern']</literal> statement instead.
</para>
</note>
<para>
<example>
<title><function>mysql_list_tables</function> alternative example</title>
<programlisting role="php">
<refentry id="function.mysql-list-tables">
<refnamediv>
<refname>mysql_list_tables</refname>
<refpurpose>List tables in a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_list_tables</methodname>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_list_tables</function> takes a database name and
returns a result pointer much like the
<function>mysql_query</function> function.
Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
</para>
<para>
The <parameter>database</parameter> parameter is the name of the
database to retrieve the list of tables from. Upon failure,
<function>mysql_list_tables</function> returns &false;.
</para>
<para>
For downward compatibility, the function alias named
<function>mysql_listtables</function> can be used. This is
deprecated however and is not recommended.
</para>
<note>
<para>
The function <function>mysql_list_tables</function> is deprecated. It
is preferable to use <function>mysql_query</function> to issue a
SQL <literal>SHOW TABLES [FROM db_name] [LIKE 'pattern']</literal> statement instead.
</para>
</note>
<para>
<example>
<title><function>mysql_list_tables</function> alternative example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbname = 'mysql_dbname';
@ -69,16 +69,16 @@ while ($row = mysql_fetch_row($result)) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_list_dbs</function> and
<function>mysql_tablename</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_list_dbs</function> and
<function>mysql_tablename</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-num-fields">
<refnamediv>
<refname>mysql_num_fields</refname>
<refpurpose>Get number of fields in result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_num_fields</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_num_fields</function> returns the number of
fields in the result set <parameter>result</parameter>.
</para>
<para>
<example>
<title>A <function>mysql_num_fields</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-num-fields">
<refnamediv>
<refname>mysql_num_fields</refname>
<refpurpose>Get number of fields in result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_num_fields</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_num_fields</function> returns the number of
fields in the result set <parameter>result</parameter>.
</para>
<para>
<example>
<title>A <function>mysql_num_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
@ -32,22 +32,22 @@ if (!$result) {
echo mysql_num_fields($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_numfields</function>
can also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_select_db</function>,
<function>mysql_query</function>,
<function>mysql_fetch_field</function> and
<function>mysql_num_rows</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
For downward compatibility <function>mysql_numfields</function>
can also be used. This is deprecated however.
</para>
<para>
See also
<function>mysql_select_db</function>,
<function>mysql_query</function>,
<function>mysql_fetch_field</function> and
<function>mysql_num_rows</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-num-rows">
<refnamediv>
<refname>mysql_num_rows</refname>
<refpurpose>Get number of rows in result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_num_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_num_rows</function> 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 <function>mysql_affected_rows</function>.
<example>
<title><function>mysql_num_rows</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-num-rows">
<refnamediv>
<refname>mysql_num_rows</refname>
<refpurpose>Get number of rows in result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_num_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_num_rows</function> 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 <function>mysql_affected_rows</function>.
<example>
<title><function>mysql_num_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -33,31 +33,31 @@ echo "$num_rows Rows\n";
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
If you use <function>mysql_unbuffered_query</function>,
<function>mysql_num_rows</function> will not return the
correct value until all the rows in the result set have been
retrieved.
</para>
</note>
<para>
See also
<function>mysql_affected_rows</function>,
<function>mysql_connect</function>,
<function>mysql_data_seek</function>,
<function>mysql_select_db</function> and
<function>mysql_query</function>.
</para>
<para>
For downward compatibility <function>mysql_numrows</function> can
also be used. This is deprecated however.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
If you use <function>mysql_unbuffered_query</function>,
<function>mysql_num_rows</function> will not return the
correct value until all the rows in the result set have been
retrieved.
</para>
</note>
<para>
See also
<function>mysql_affected_rows</function>,
<function>mysql_connect</function>,
<function>mysql_data_seek</function>,
<function>mysql_select_db</function> and
<function>mysql_query</function>.
</para>
<para>
For downward compatibility <function>mysql_numrows</function> can
also be used. This is deprecated however.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,94 +1,94 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-pconnect">
<refnamediv>
<refname>mysql_pconnect</refname>
<refpurpose>
Open a persistent connection to a MySQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_pconnect</methodname>
<methodparam choice="opt"><type>string</type><parameter>server</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>client_flags</parameter></methodparam>
</methodsynopsis>
<refentry id="function.mysql-pconnect">
<refnamediv>
<refname>mysql_pconnect</refname>
<refpurpose>
Open a persistent connection to a MySQL server
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_pconnect</methodname>
<methodparam choice="opt"><type>string</type><parameter>server</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>client_flags</parameter></methodparam>
</methodsynopsis>
<para>
Returns a positive MySQL persistent link identifier on success,
or &false; on error.
</para>
<para>
<function>mysql_pconnect</function> establishes a connection
to a MySQL server. The following defaults are assumed for
missing optional parameters: <parameter>server</parameter> =
'localhost:3306', <parameter>username</parameter> = name of the
user that owns the server process and
<parameter>password</parameter> = empty password.
The <parameter>client_flags</parameter>
parameter can be a combination of the constants
MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_IGNORE_SPACE or
MYSQL_CLIENT_INTERACTIVE.
</para>
<para>
The <parameter>server</parameter> parameter can also include a port
number. e.g. &quot;hostname:port&quot; or a path to a socket
e.g. &quot;:/path/to/socket&quot; for the localhost.
<note>
<para>
Returns a positive MySQL persistent link identifier on success,
or &false; on error.
Support for &quot;:port&quot; was added in 3.0B4.
</para>
<para>
<function>mysql_pconnect</function> establishes a connection
to a MySQL server. The following defaults are assumed for
missing optional parameters: <parameter>server</parameter> =
'localhost:3306', <parameter>username</parameter> = name of the
user that owns the server process and
<parameter>password</parameter> = empty password.
The <parameter>client_flags</parameter>
parameter can be a combination of the constants
MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_IGNORE_SPACE or
MYSQL_CLIENT_INTERACTIVE.
</para>
<para>
The <parameter>server</parameter> parameter can also include a port
number. e.g. &quot;hostname:port&quot; or a path to a socket
e.g. &quot;:/path/to/socket&quot; for the localhost.
<note>
<para>
Support for &quot;:port&quot; was added in 3.0B4.
</para>
<para>
Support for the &quot;:/path/to/socket&quot; was added in
3.0.10.
</para>
</note>
Support for the &quot;:/path/to/socket&quot; was added in
3.0.10.
</para>
</note>
</para>
<!-- TODO move the story to features.persistent, and refer to that -->
<para>
<function>mysql_pconnect</function> acts very much like
<function>mysql_connect</function> with two major differences.
</para>
<para>
First, when connecting, the function would first try to find a
(persistent) link that's already open with the same host,
username and password. If one is found, an identifier for it
will be returned instead of opening a new connection.
</para>
<para>
Second, the connection to the SQL server will not be closed when
the execution of the script ends. Instead, the link will remain
open for future use (<function>mysql_close</function> will not
close links established by <function>mysql_pconnect</function>).
</para>
<para>
The optional <parameter>client_flags</parameter> parameter became
available in PHP 4.3.0.
</para>
<para>
This type of link is therefore called 'persistent'.
</para>
<note>
<para>
Note, that these kind of links only work if you are using
a module version of PHP. See the
<link linkend="features.persistent-connections">Persistent
Database Connections</link> section for more information.
</para>
</note>
<warning>
<para>
Using persistent connections can require a bit of tuning of your Apache
and MySQL configurations to ensure that you do not exceed the number of
connections allowed by MySQL.
</para>
</warning>
</refsect1>
</refentry>
<!-- TODO move the story to features.persistent, and refer to that -->
<para>
<function>mysql_pconnect</function> acts very much like
<function>mysql_connect</function> with two major differences.
</para>
<para>
First, when connecting, the function would first try to find a
(persistent) link that's already open with the same host,
username and password. If one is found, an identifier for it
will be returned instead of opening a new connection.
</para>
<para>
Second, the connection to the SQL server will not be closed when
the execution of the script ends. Instead, the link will remain
open for future use (<function>mysql_close</function> will not
close links established by <function>mysql_pconnect</function>).
</para>
<para>
The optional <parameter>client_flags</parameter> parameter became
available in PHP 4.3.0.
</para>
<para>
This type of link is therefore called 'persistent'.
</para>
<note>
<para>
Note, that these kind of links only work if you are using
a module version of PHP. See the
<link linkend="features.persistent-connections">Persistent
Database Connections</link> section for more information.
</para>
</note>
<warning>
<para>
Using persistent connections can require a bit of tuning of your Apache
and MySQL configurations to ensure that you do not exceed the number of
connections allowed by MySQL.
</para>
</warning>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.100 -->
<refentry id="function.mysql-ping">
<refnamediv>
<refname>mysql_ping</refname>
<refpurpose>Ping a server connection or reconnect if there is no connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_ping</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_ping</function> 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.
<function>mysql_ping</function> returns &true; if the connection to the
server is working, otherwise &false;.
</para>
<para>
<example>
<title>A <function>mysql_ping</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-ping">
<refnamediv>
<refname>mysql_ping</refname>
<refpurpose>Ping a server connection or reconnect if there is no connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_ping</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_ping</function> 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.
<function>mysql_ping</function> returns &true; if the connection to the
server is working, otherwise &false;.
</para>
<para>
<example>
<title>A <function>mysql_ping</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
set_time_limit(0);
@ -52,16 +52,16 @@ mysql_free_result($result);
$result2 = mysql_query($sql2);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_thread_id</function> and
<function>mysql_list_processes</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_thread_id</function> and
<function>mysql_list_processes</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,60 +1,60 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.21 $ -->
<!-- $Revision: 1.22 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.100 -->
<refentry id="function.mysql-real-escape-string">
<refnamediv>
<refname>mysql_real_escape_string</refname>
<refpurpose>
Escapes special characters in a string for use in a SQL statement
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_real_escape_string</methodname>
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<variablelist>
<varlistentry>
<term><parameter>unescaped_string</parameter></term>
<listitem><simpara>The string to escape</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>link_identifier</parameter> (optional)</term>
<listitem><simpara>The mysql connection resource</simpara></listitem>
</varlistentry>
</variablelist>
</para>
<para>
This function will escape special characters in the
<parameter>unescaped_string</parameter>, taking into account the current
character set of the connection so that it is safe to place it in a
<function>mysql_query</function>. If binary data is to be inserted, this function
must be used.
</para>
<note>
<para>
A MySQL connection is required before using
<function>mysql_real_escape_string</function> otherwise an error of
level <literal>E_WARNING</literal> is generated, and &false; is
returned. If <parameter>link_identifier</parameter> isn't defined, the
last MySQL connection is used.
</para>
</note>
<para>
<function>mysql_real_escape_string</function> calls MySQL's library function
mysql_escape_string, which prepends backslashes to the following characters:
<literal>NULL</literal>, <literal>\x00</literal>, <literal>\n</literal>,
<literal>\r</literal>, <literal>\</literal>, <literal>'</literal>,
<literal>"</literal> and <literal>\x1a</literal>.
</para>
<para>
<example>
<title>Simple <function>mysql_real_escape_string</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-real-escape-string">
<refnamediv>
<refname>mysql_real_escape_string</refname>
<refpurpose>
Escapes special characters in a string for use in a SQL statement
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_real_escape_string</methodname>
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<variablelist>
<varlistentry>
<term><parameter>unescaped_string</parameter></term>
<listitem><simpara>The string to escape</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>link_identifier</parameter> (optional)</term>
<listitem><simpara>The mysql connection resource</simpara></listitem>
</varlistentry>
</variablelist>
</para>
<para>
This function will escape special characters in the
<parameter>unescaped_string</parameter>, taking into account the current
character set of the connection so that it is safe to place it in a
<function>mysql_query</function>. If binary data is to be inserted, this function
must be used.
</para>
<note>
<para>
A MySQL connection is required before using
<function>mysql_real_escape_string</function> otherwise an error of
level <literal>E_WARNING</literal> is generated, and &false; is
returned. If <parameter>link_identifier</parameter> isn't defined, the
last MySQL connection is used.
</para>
</note>
<para>
<function>mysql_real_escape_string</function> calls MySQL's library function
mysql_escape_string, which prepends backslashes to the following characters:
<literal>NULL</literal>, <literal>\x00</literal>, <literal>\n</literal>,
<literal>\r</literal>, <literal>\</literal>, <literal>'</literal>,
<literal>"</literal> and <literal>\x1a</literal>.
</para>
<para>
<example>
<title>Simple <function>mysql_real_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Connect
@ -67,28 +67,28 @@ $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
mysql_real_escape_string($password));
?>
]]>
</programlisting>
</example>
</para>
<para>
This function must always (with few exceptions) be used to make data
safe before sending a query to MySQL.
</para>
<note>
<para>
If <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> is enabled,
first apply <function>stripslashes</function> to the data. Using this function
on data which has already been escaped will escape the data twice.
</para>
</note>
<para>
If this function is not used to escape data, the query is vulnerable to
<link linkend="security.database.sql-injection">SQL Injection Attacks</link>.
</para>
<para>
<example>
<title>An example SQL Injection Attack</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
This function must always (with few exceptions) be used to make data
safe before sending a query to MySQL.
</para>
<note>
<para>
If <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> is enabled,
first apply <function>stripslashes</function> to the data. Using this function
on data which has already been escaped will escape the data twice.
</para>
</note>
<para>
If this function is not used to escape data, the query is vulnerable to
<link linkend="security.database.sql-injection">SQL Injection Attacks</link>.
</para>
<para>
<example>
<title>An example SQL Injection Attack</title>
<programlisting role="php">
<![CDATA[
<?php
// Query database to check if there are any matching users
@ -103,30 +103,30 @@ $_POST['password'] = "' OR ''='";
echo $query;
?>
]]>
</programlisting>
<para>
The query sent to MySQL:
</para>
<screen>
</programlisting>
<para>
The query sent to MySQL:
</para>
<screen>
<![CDATA[
SELECT * FROM users WHERE name='aidan' AND password='' OR ''=''
]]>
</screen>
<para>
This would allow anyone to log in without a valid password.
</para>
</example>
</para>
</screen>
<para>
<example>
<title>A "Best Practice" query</title>
<para>
Using <function>mysql_real_escape_string</function> around each variable
prevents SQL Injection. This example demonstrates the "best practice"
method for querying a database, independent of the
<link linkend="security.magicquotes">Magic Quotes</link> setting.
</para>
<programlisting role="php">
This would allow anyone to log in without a valid password.
</para>
</example>
</para>
<para>
<example>
<title>A "Best Practice" query</title>
<para>
Using <function>mysql_real_escape_string</function> around each variable
prevents SQL Injection. This example demonstrates the "best practice"
method for querying a database, independent of the
<link linkend="security.magicquotes">Magic Quotes</link> setting.
</para>
<programlisting role="php">
<![CDATA[
<?php
// Quote variable to make safe
@ -155,32 +155,32 @@ $query = sprintf("SELECT * FROM users WHERE user=%s AND password=%s",
mysql_query($query);
?>
]]>
</programlisting>
<para>
The query will now execute correctly, and SQL Injection attacks will not work.
</para>
</example>
</para>
<note>
<simpara>
<function>mysql_real_escape_string</function> does not escape
<literal>%</literal> and <literal>_</literal>. These are wildcards in
MySQL if combined with <literal>LIKE</literal>, <literal>GRANT</literal>,
or <literal>REVOKE</literal>.
</simpara>
</note>
</programlisting>
<para>
See also
<function>mysql_client_encoding</function>,
<function>addslashes</function>,
<function>stripslashes</function>,
the <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>,
and the
<link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>
directive.
The query will now execute correctly, and SQL Injection attacks will not work.
</para>
</refsect1>
</refentry>
</example>
</para>
<note>
<simpara>
<function>mysql_real_escape_string</function> does not escape
<literal>%</literal> and <literal>_</literal>. These are wildcards in
MySQL if combined with <literal>LIKE</literal>, <literal>GRANT</literal>,
or <literal>REVOKE</literal>.
</simpara>
</note>
<para>
See also
<function>mysql_client_encoding</function>,
<function>addslashes</function>,
<function>stripslashes</function>,
the <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>,
and the
<link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>
directive.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,46 +1,46 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-result">
<refnamediv>
<refname>mysql_result</refname>
<refpurpose>Get result data</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>mysql_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>
field
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_result</function> 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.
</para>
<para>
When working on large result sets, you should consider using one
of the functions that fetch an entire row (specified below). As
these functions return the contents of multiple cells in one
function call, they're MUCH quicker than
<function>mysql_result</function>. Also, note that specifying a
numeric offset for the field argument is much quicker than
specifying a fieldname or tablename.fieldname argument.
</para>
<para>
Calls to <function>mysql_result</function> should not be mixed
with calls to other functions that deal with the result set.
</para>
<para>
<example>
<title><function>mysql_result</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-result">
<refnamediv>
<refname>mysql_result</refname>
<refpurpose>Get result data</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>mysql_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>
field
</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_result</function> 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.
</para>
<para>
When working on large result sets, you should consider using one
of the functions that fetch an entire row (specified below). As
these functions return the contents of multiple cells in one
function call, they're MUCH quicker than
<function>mysql_result</function>. Also, note that specifying a
numeric offset for the field argument is much quicker than
specifying a fieldname or tablename.fieldname argument.
</para>
<para>
Calls to <function>mysql_result</function> should not be mixed
with calls to other functions that deal with the result set.
</para>
<para>
<example>
<title><function>mysql_result</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -56,18 +56,18 @@ echo mysql_result($result, 2); // outputs third employee's name
mysql_close($link);
?>
]]>
</programlisting>
</example>
</para>
<para>
Recommended high-performance alternatives :
<function>mysql_fetch_row</function>,
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function> and
<function>mysql_fetch_object</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
Recommended high-performance alternatives :
<function>mysql_fetch_row</function>,
<function>mysql_fetch_array</function>,
<function>mysql_fetch_assoc</function> and
<function>mysql_fetch_object</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-select-db">
<refnamediv>
<refname>mysql_select_db</refname>
<refpurpose>Select a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_select_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
&return.success;
</para>
<para>
<function>mysql_select_db</function> 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 <function>mysql_connect</function> was
called without arguments, and use it.
</para>
<para>
Every subsequent call to <function>mysql_query</function> will be
made on the active database.
</para>
<para>
<example>
<title><function>mysql_select_db</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-select-db">
<refnamediv>
<refname>mysql_select_db</refname>
<refpurpose>Select a MySQL database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>mysql_select_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
&return.success;
</para>
<para>
<function>mysql_select_db</function> 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 <function>mysql_connect</function> was
called without arguments, and use it.
</para>
<para>
Every subsequent call to <function>mysql_query</function> will be
made on the active database.
</para>
<para>
<example>
<title><function>mysql_select_db</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -49,21 +49,21 @@ if (!$db_selected) {
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_connect</function>,
<function>mysql_pconnect</function> and
<function>mysql_query</function>.
</para>
<para>
For downward compatibility <function>mysql_selectdb</function>
can also be used. This is deprecated however.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_connect</function>,
<function>mysql_pconnect</function> and
<function>mysql_query</function>.
</para>
<para>
For downward compatibility <function>mysql_selectdb</function>
can also be used. This is deprecated however.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,30 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-tablename">
<refnamediv>
<refname>mysql_tablename</refname>
<refpurpose>Get table name of field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_tablename</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>i</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_tablename</function> takes a result pointer
returned by the <function>mysql_list_tables</function> function
as well as an integer index and returns the name of a table. The
<function>mysql_num_rows</function> function may be used to
determine the number of tables in the result pointer.
Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
<example>
<title><function>mysql_tablename</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-tablename">
<refnamediv>
<refname>mysql_tablename</refname>
<refpurpose>Get table name of field</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_tablename</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>i</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_tablename</function> takes a result pointer
returned by the <function>mysql_list_tables</function> function
as well as an integer index and returns the name of a table. The
<function>mysql_num_rows</function> function may be used to
determine the number of tables in the result pointer.
Use the <function>mysql_tablename</function> function to
traverse this result pointer, or any function for result tables,
such as <function>mysql_fetch_array</function>.
<example>
<title><function>mysql_tablename</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
mysql_connect("localhost", "mysql_user", "mysql_password");
@ -37,17 +37,17 @@ for ($i = 0; $i < $num_rows; $i++) {
mysql_free_result($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_list_tables</function>,
<function>mysql_field_table</function>, and
<function>mysql_db_name</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also
<function>mysql_list_tables</function>,
<function>mysql_field_table</function>, and
<function>mysql_db_name</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,28 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.100 -->
<refentry id="function.mysql-thread-id">
<refnamediv>
<refname>mysql_thread_id</refname>
<refpurpose>Return the current thread ID</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_thread_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_thread_id</function> returns the current thread ID. If
the connection is lost and you reconnect with
<function>mysql_ping</function>, 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.
</para>
<para>
<example>
<title><function>mysql_thread_id</function> example</title>
<programlisting role="php">
<refentry id="function.mysql-thread-id">
<refnamediv>
<refname>mysql_thread_id</refname>
<refpurpose>Return the current thread ID</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_thread_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_thread_id</function> returns the current thread ID. If
the connection is lost and you reconnect with
<function>mysql_ping</function>, 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.
</para>
<para>
<example>
<title><function>mysql_thread_id</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
@ -32,24 +32,24 @@ if ($thread_id){
}
?>
]]>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
</programlisting>
<para>
The above example would produce the following output:
</para>
<screen>
<![CDATA[
current thread id is 73
]]>
</screen>
</example>
</para>
<para>
See also
<function>mysql_ping</function> and
<function>mysql_list_processes</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>mysql_ping</function> and
<function>mysql_list_processes</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-unbuffered-query">
<refnamediv>
<refname>mysql_unbuffered_query</refname>
<refpurpose>
Send an SQL query to MySQL, without fetching and buffering the
result rows
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_unbuffered_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_unbuffered_query</function> sends a SQL query
<parameter>query</parameter> to MySQL, without fetching and
buffering the result rows automatically, as
<function>mysql_query</function> does. On the one hand, this
saves a considerable amount of memory with SQL queries that
produce large result sets. On the other hand, you can start
working on the result set immediately after the first row has
been retrieved: you don't have to wait until the complete SQL
query has been performed. When using multiple DB-connects, you
have to specify the optional parameter
<parameter>link_identifier</parameter>.
</para>
<note>
<para>
The benefits of <function>mysql_unbuffered_query</function> come
at a cost: You cannot use <function>mysql_num_rows</function> and
<function>mysql_data_seek</function> on a result set returned from
<function>mysql_unbuffered_query</function>. You also have to
fetch all result rows from an unbuffered SQL query, before you
can send a new SQL query to MySQL.
</para>
</note>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-unbuffered-query">
<refnamediv>
<refname>mysql_unbuffered_query</refname>
<refpurpose>
Send an SQL query to MySQL, without fetching and buffering the
result rows
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>resource</type><methodname>mysql_unbuffered_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_unbuffered_query</function> sends a SQL query
<parameter>query</parameter> to MySQL, without fetching and
buffering the result rows automatically, as
<function>mysql_query</function> does. On the one hand, this
saves a considerable amount of memory with SQL queries that
produce large result sets. On the other hand, you can start
working on the result set immediately after the first row has
been retrieved: you don't have to wait until the complete SQL
query has been performed. When using multiple DB-connects, you
have to specify the optional parameter
<parameter>link_identifier</parameter>.
</para>
<note>
<para>
The benefits of <function>mysql_unbuffered_query</function> come
at a cost: You cannot use <function>mysql_num_rows</function> and
<function>mysql_data_seek</function> on a result set returned from
<function>mysql_unbuffered_query</function>. You also have to
fetch all result rows from an unbuffered SQL query, before you
can send a new SQL query to MySQL.
</para>
</note>
<para>
See also <function>mysql_query</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: