1
<?xml version='1.0' encoding='UTF-8'?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
"docbook/dtd/xml/4.2/docbookx.dtd" [
4
<!ENTITY % global_ents SYSTEM "../global.ent">
7
<refentry id="functions.mysql_real_escape_string" display-name="0">
9
<refentrytitle>mysql_real_escape_string</refentrytitle>
12
<refname>mysql_real_escape_string</refname>
13
<refpurpose>Escapes special characters in a string</refpurpose>
15
<refsect1 role="description">
17
<type>unsigned long</type>
18
<methodname>mysql_real_escape_string</methodname>
19
<methodparam><type>MYSQL *</type><parameter>mysql</parameter></methodparam>
20
<methodparam><type>char *</type><parameter>to</parameter></methodparam>
21
<methodparam><type>const char *</type><parameter>from</parameter></methodparam>
22
<methodparam><type>unsigned</type><parameter>long</parameter></methodparam>
25
<para>This function is used to create a legal SQL string that you can use in an SQL statement. The given string is encoded to an escaped SQL string, taking into account the current character set of the connection.</para>
27
<refsect1 role="parameters">
28
<title>Parameters</title>
30
<varlistentry><term><parameter>mysql</parameter></term><listitem><para>¶m.mysql;</para></listitem></varlistentry>
31
<varlistentry><term><parameter>to</parameter></term><listitem><para>buffer for the encoded string. The size of this buffer must be length * 2 + 1 bytes: in worst case every character of the from stirng needs to be escaped. Additionally a trailing 0 character will be appended.</para></listitem></varlistentry>
32
<varlistentry><term><parameter>from</parameter></term><listitem><para>An string which will be encoded by <function>mysql_real_escape_string()</function>.</para></listitem></varlistentry>
33
<varlistentry><term><parameter>long</parameter></term><listitem><para>The length of <parameter>from</parameter> string.</para></listitem></varlistentry>
37
<refsect1 role="returnvalue">
38
<title>Return value</title>
39
<para>Returns the length of the encoded (<parameter>to</parameter>) string.</para>
41
<refsect1 role="returnvalue">
47
<refsect1 role="seealso">
48
<title>See also</title>