php-doc-en/reference/mysql/functions/mysql-escape-string.xml
Jakub Vrana a1ddba3e96 rtrim($refpurpose, '.')
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166882 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-20 09:37:01 +00:00

94 lines
No EOL
2.7 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- 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">
<![CDATA[
<?php
$item = "Zak's Laptop";
$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>
<![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>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->