Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5857

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Escapes a string for use as a query parameter</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-error-string.html">sqlite_error_string</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-exec.html">sqlite_exec</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sqlite-escape-string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_escape_string</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_escape_string</span> &mdash; <span class="dc-title">Escapes a string for use as a query parameter</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-escape-string-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>sqlite_escape_string</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$item</code></span>
   )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>sqlite_escape_string()</strong></span> will correctly quote the string
   specified by <em><code class="parameter">item</code></em>
   for use in an SQLite SQL statement.  This includes doubling up
   single-quote characters (<em>&#039;</em>) and checking for
   binary-unsafe characters in the query string.
  </p>
  <p class="para">
   Although the encoding makes it safe to insert the data, it will render
   simple text comparisons and <em>LIKE</em> clauses in your
   queries unusable for the columns that contain the binary data.  In
   practice, this shouldn&#039;t be a problem, as your schema should be such that
   you don&#039;t use such things on binary columns (in fact, it might be better to
   store binary data using other means, such as in files).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-escape-string-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">item</code></em></span>
     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being quoted.
      </p>
      <p class="para">
       If the <em><code class="parameter">item</code></em> contains a <em>NUL</em>
       character, or if it begins with a character whose ordinal value is
       <em>0x01</em>, PHP will apply a binary encoding scheme so that
       you can safely store and retrieve binary data.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-escape-string-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an escaped <span class="type"><a href="language.types.string.html" class="type string">string</a></span> for use in an SQLite SQL statement.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.sqlite-escape-string-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    Do not use this function to encode the return values from UDF&#039;s created
    using  <span class="function"><a href="function.sqlite-create-function.html" class="function">sqlite_create_function()</a></span> or
     <span class="function"><a href="function.sqlite-create-aggregate.html" class="function">sqlite_create_aggregate()</a></span> - use
     <span class="function"><a href="function.sqlite-udf-encode-binary.html" class="function">sqlite_udf_encode_binary()</a></span> instead.
   </span>
  </p></blockquote>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="simpara">
     <span class="function"><a href="function.addslashes.html" class="function">addslashes()</a></span> should <em class="emphasis">NOT</em> be used to
    quote your strings for SQLite queries; it will lead to strange results
    when retrieving your data.
   </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-escape-string-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.sqlite-udf-encode-binary.html" class="function" rel="rdfs-seeAlso">sqlite_udf_encode_binary()</a> - Encode binary data before returning it from an UDF</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-error-string.html">sqlite_error_string</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-exec.html">sqlite_exec</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>