changed typos (omited -> omitted)

changed description for mysql_escape_string
documentation for new functions:
  - mysql_character_set_name
  - mysql_ping
  - mysql_real_escape_string
  - mysql_thread_id


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@75137 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Georg Richter 2002-03-25 12:22:22 +00:00
parent 66ec894603
commit 7f6f235b80

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.99 $ -->
<!-- $Revision: 1.100 $ -->
<reference id="ref.mysql">
<title>MySQL Functions</title>
<titleabbrev>MySQL</titleabbrev>
@ -293,6 +293,48 @@
</refsect1>
</refentry>
<refentry id="function.mysql-character_set_name">
<refnamediv>
<refname>mysql_character_set_name</refname>
<refpurpose>Returns the name of the character set</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>mysql_character_set_name</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>mysql_character_set_name</function> returns the default
character set name for the current connection.
</para>
<example>
<title><function>mysql_character_set_name</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$charset = mysql_character_set_name($link);
printf ("current character set is %s\n", $charset);
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
latin1
]]>
</screen>
</para>
</example>
<para>
See also:
<function>mysql_real_escape_string</function>
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-close">
<refnamediv>
<refname>mysql_close</refname>
@ -786,10 +828,10 @@ echo mysql_errno().": ".mysql_error()."<BR>";
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>mysql_escape_string</methodname>
<methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam>
</methodsynopsis>
<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>.
@ -799,7 +841,39 @@ echo mysql_errno().": ".mysql_error()."<BR>";
<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
mysql_real_escape_string() 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>
<example>
<title><function>mysql_real_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$item = "Zak's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
}
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
Escaped string: Zak\'s Laptop
]]>
</screen>
</para>
</example>
<para>
See also:
<function>mysql_real_escape_string</function>
</para>
</refsect1>
</refentry>
@ -1715,6 +1789,10 @@ mysql_free_result ($result);
</para>
</example>
</para>
<para>
See also:
<function>mysql_thread_id</function>
</para>
</refsect1>
</refentry>
@ -1906,6 +1984,36 @@ echo "$num_rows Rows\n";
</refsect1>
</refentry>
<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>
See also:
<function>mysql_thread_id</function>
<function>mysql_list_processes</function>
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-query">
<refnamediv>
<refname>mysql_query</refname>
@ -2059,6 +2167,61 @@ $result = mysql_query("SELECT my_col FROM my_tbl")
</refsect1>
</refentry>
<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, taking into account the current charset of the connection.
</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>
This function will escape special characters in the
<parameter>unescaped_string</parameter>, taking into account the current
charset of the connection so that it is safe to place it in a
<function>mysql_query</function>.
</para>
<note>
<simpara>
<function>mysql_real_escape_string</function> does not escape
<literal>%</literal> and <literal>_</literal>.
</simpara>
</note>
<example>
<title><function>mysql_real_escape_string</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$item = "Zak's Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
}
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
Escaped string: Zak\'s Laptop
]]>
</screen>
</para>
</example>
<para>
See also:
<function>mysql_escape_string</function>
<function>mysql_character_set_name</function>
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-result">
<refnamediv>
<refname>mysql_result</refname>
@ -2182,6 +2345,49 @@ for ($i = 0; $i < mysql_num_rows($result); $i++) {
</refsect1>
</refentry>
<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>
<example>
<title><function>mysql_list_processes</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysql_connect('localhost', 'myname', 'secret');
$thread_id = mysql_thread_id($link);
if ($thread_id){
printf ("current thread id is %d\n", $thread_id);
}
]]>
</programlisting>
<para>
The above example would produce the following output:
<screen>
<![CDATA[
current thread_id is 73
]]>
</screen>
</para>
</example>
<para>
See also:
<function>mysql_ping</function>
<function>mysql_list_processes</function>
</para>
</refsect1>
</refentry>
<refentry id="function.mysql-get-client-info">
<refnamediv>
<refname>mysql_get_client_info</refname>
@ -2218,7 +2424,7 @@ for ($i = 0; $i < mysql_num_rows($result); $i++) {
<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 omited, the
name. If <parameter>link_identifier</parameter> is omitted, the
last opened connection will be used.
</para>
<para>
@ -2294,7 +2500,7 @@ for ($i = 0; $i < mysql_num_rows($result); $i++) {
<function>mysql_stat</function> currently only returns status for uptime,
threads, queries, open tables, flush tables and queries per second. For a
complete list of other status variables you have to use the SHOW STATUS
SQL command.
sql command.
</para>
</note>
<para>