jeroen Sat May 19 13:39:38 2001 EDT
Modified files:
/phpdoc/en/functions mysql.xml
Log:
- added mysql_escape_string
- made case of MySQL consistent
Index: phpdoc/en/functions/mysql.xml
diff -u phpdoc/en/functions/mysql.xml:1.43 phpdoc/en/functions/mysql.xml:1.44
--- phpdoc/en/functions/mysql.xml:1.43 Wed May 16 15:52:23 2001
+++ phpdoc/en/functions/mysql.xml Sat May 19 13:39:38 2001
@@ -5,16 +5,16 @@
<simpara>
These functions allow you to access MySQL database servers. In
order to have these functions available, you must compile php
- with mysql support by using the
+ with MySQL support by using the
<option role="configure">--with-mysql</option> option. If you
- use this option without specifying the path to mysql, php will
- use the built-in mysql client libraries. Users who run other
- applications that use mysql (for example, running php3 and php4
+ use this option without specifying the path to MySQL, php will
+ use the built-in MySQL client libraries. Users who run other
+ applications that use MySQL (for example, running php3 and php4
as concurrent apache modules, or auth-mysql) should always
- specify the path to mysql:
+ specify the path to MySQL:
<option role="configure">--with-mysql=/path/to/mysql</option>.
This will force php to use the client libraries installed by
- mysql, avoiding any conflicts.
+ MySQL, avoiding any conflicts.
</simpara>
<simpara>
More information about MySQL can be found at <ulink
@@ -541,14 +541,14 @@
</funcprototype>
</funcsynopsis>
<para>
- Returns the error number from the last mySQL function, or
+ 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
+ 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
+ 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
@@ -591,17 +591,17 @@
</funcprototype>
</funcsynopsis>
<para>
- Returns the error text from the last mySQL function, or
+ Returns the error text from the last MySQL function, or
<literal>''</literal> (the empty string) if no error occurred.
</para>
<para>
- Errors coming back from the mySQL database backend no longer
+ 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
+ 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.
+ sure you check the value before calling another MySQL function.
<informalexample>
<programlisting role="php">
<?php
@@ -621,6 +621,34 @@
</refsect1>
</refentry>
+ <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>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>string <function>mysql_escape_string</function></funcdef>
+ <paramdef>string <parameter>unescaped_string</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This function will escape the <parameter>unescaped_string</parameter>,
+ so that it is safe to place it in a MySQL-query.
+ </para>
+ <note>
+ <simpara>
+ <function>mysql_escape_string</function> does not escape <literal>%</literal>
+ and <literal>_</literal>.
+ </simpara>
+ </note>
+ </refsect1>
+ </refentry>
+
<refentry id="function.mysql-fetch-array">
<refnamediv>
<refname>mysql_fetch_array</refname>
@@ -696,65 +724,6 @@
</refsect1>
</refentry>
- <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>
- <funcsynopsis>
- <funcprototype>
- <funcdef>array <function>mysql_fetch_assoc</function></funcdef>
- <paramdef>resource <parameter>result</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <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 must use <function>mysql_fetch_array</function> and
- have it return the numeric indices as well.
- </para>
- <para>
- An important thing to note is that using
- <function>mysql_fetch_assoc</function> is NOT significantly
- slower than using <function>mysql_fetch_row</function>, while it
- provides a significant added value.
- </para>
- <para>
- For further details, see also
- <function>mysql_fetch_row</function> and <function>mysql_fetch_array</function>.
- </para>
- <example>
- <title><function>Mysql_fetch_assoc</function></title>
- <programlisting role="php">
-<?php
-mysql_connect ($host, $user, $password);
-$result = mysql_db_query ("database","select * from table");
-while ($row = mysql_fetch_assoc ($result)) {
- echo $row["user_id"];
- echo $row["fullname"];
-}
-mysql_free_result ($result);
-?>
- </programlisting>
- </example>
- </refsect1>
- </refentry>
-
<refentry id="function.mysql-fetch-field">
<refnamediv>
<refname>mysql_fetch_field</refname>
@@ -1227,7 +1196,7 @@
detailed in the <ulink url="&url.mysql.docs;">MySQL
documentation</ulink>.
<example>
- <title>mysql field types</title>
+ <title>MySQL field types</title>
<programlisting role="php">
<?php