2010-09-08 01:27:51 +00:00
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
2010-08-20 09:35:20 +00:00
2010-09-08 01:27:51 +00:00
<refentry xml:id= "function.cubrid-real-escape-string" xmlns= "http://docbook.org/ns/docbook" xmlns:xlink= "http://www.w3.org/1999/xlink" >
<refnamediv >
<refname > cubrid_real_escape_string</refname>
<refpurpose > Returns the escaped string version of the given string</refpurpose>
</refnamediv>
<refsect1 role= "description" >
&reftitle.description;
<methodsynopsis >
<type > string</type> <methodname > cubrid_real_escape_string</methodname>
<methodparam > <type > string</type> <parameter > unescaped_string</parameter> </methodparam>
<methodparam choice= "opt" > <type > resource</type> <parameter > conn_identifier</parameter> </methodparam>
</methodsynopsis>
<para >
This function returns the escaped string version of the given string. It pre-appends backslashes to the following characters: <constant > '</constant> . This function must always (with few exceptions) be used to make data safe before sending a query to CUBRID.
</para>
</refsect1>
<refsect1 role= "parameters" >
&reftitle.parameters;
<para >
<variablelist >
<varlistentry >
<term > <parameter > unescaped_string</parameter> </term>
<listitem > <para > The string that is to be escaped.</para> </listitem>
</varlistentry>
<varlistentry >
<term > <parameter > conn_identifier</parameter> </term>
<listitem > <para > The CUBRID connection. If the connection identifier is not specified, the last link opened by <function > cubrid_connect</function> is assumed.</para> </listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role= "returnvalues" >
&reftitle.returnvalues;
<para >
Escaped string version of the given string, on success.
</para>
<para >
&false; on failure.
</para>
2010-08-20 09:35:20 +00:00
</refsect1>
2010-09-08 01:27:51 +00:00
<refsect1 role= "examples" >
&reftitle.examples;
<example >
<title > <function > cubrid_real_escape_string</function> example</title>
<programlisting role= "php" >
< ![CDATA[
< ?php
$user = "'username'";
$password = "\"pass\"";
$query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
cubrid_real_escape_string($user),
cubrid_real_escape_string($password));
echo $query;
?>
]]>
</programlisting>
&example.outputs;
<screen >
< ![CDATA[
Result:
2010-11-11 11:08:55 +00:00
SELECT * FROM users WHERE user='\'username\'' AND password='"pass"'
2010-09-08 01:27:51 +00:00
]]>
</screen>
</example>
</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:"~/.phpdoc/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
-->