<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ibase.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.ibase-query.php',
    1 => 'ibase_query',
    2 => 'Execute a query on an InterBase database',
  ),
  'up' => 
  array (
    0 => 'ref.ibase.php',
    1 => 'Firebird/InterBase Functions',
  ),
  'prev' => 
  array (
    0 => 'function.ibase-prepare.php',
    1 => 'ibase_prepare',
  ),
  'next' => 
  array (
    0 => 'function.ibase-restore.php',
    1 => 'ibase_restore',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ibase/functions/ibase-query.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ibase-query" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ibase_query</h1>
  <p class="verinfo">(PHP 5, PHP 7 &lt; 7.4.0)</p><p class="refpurpose"><span class="refname">ibase_query</span> &mdash; <span class="dc-title">Execute a query on an InterBase database</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ibase-query-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ibase_query</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$link_identifier</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$query</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$bind_args</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></div>

  <p class="simpara">
   Performs a query on an InterBase database.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ibase-query-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">link_identifier</code></dt>
    <dd>
     <span class="simpara">
      An InterBase link identifier. If omitted, the last opened link is
      assumed.
     </span>
    </dd>
   
   
    <dt><code class="parameter">query</code></dt>
    <dd>
     <span class="simpara">
      An InterBase query.
     </span>
    </dd>
   
   
    <dt><code class="parameter">bind_args</code></dt>
    <dd>
     <span class="simpara">
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ibase-query-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
   If the query raises an error, returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. If it is successful and
   there is a (possibly empty) result set (such as with a SELECT query),
   returns a result identifier. If the query was successful and there were
   no results, returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    In PHP 5.0.0 and up, this function will return the number of rows
    affected by the query for INSERT, UPDATE and DELETE statements. In order
    to retain backward compatibility, it will return <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> for these
    statements if the query succeeded without affecting any rows.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 errors" id="refsect1-function.ibase-query-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="simpara">
   If you get some error like &quot;arithmetic exception, numeric overflow, or
   string truncation. Cannot transliterate character between character sets&quot;
   (this occurs when you try use some character with accents) when using this
   and after <span class="function"><strong>ibase_query()</strong></span> you must set the character set
   (i.e. ISO8859_1 or your current character set).
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ibase-query-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>ibase_query()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$host </span><span style="color: #007700">= </span><span style="color: #DD0000">'localhost:/path/to/your.gdb'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$dbh </span><span style="color: #007700">= </span><span style="color: #0000BB">ibase_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$host</span><span style="color: #007700">, </span><span style="color: #0000BB">$username</span><span style="color: #007700">, </span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #DD0000">'SELECT * FROM tblname'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$sth </span><span style="color: #007700">= </span><span style="color: #0000BB">ibase_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">, </span><span style="color: #0000BB">$stmt</span><span style="color: #007700">) or die(</span><span style="color: #0000BB">ibase_errmsg</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ibase-query-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.ibase-errmsg.php" class="function" rel="rdfs-seeAlso">ibase_errmsg()</a> - Return error messages</span></li>
   <li><span class="function"><a href="function.ibase-fetch-row.php" class="function" rel="rdfs-seeAlso">ibase_fetch_row()</a> - Fetch a row from an InterBase database</span></li>
   <li><span class="function"><a href="function.ibase-fetch-object.php" class="function" rel="rdfs-seeAlso">ibase_fetch_object()</a> - Get an object from a InterBase database</span></li>
   <li><span class="function"><a href="function.ibase-free-result.php" class="function" rel="rdfs-seeAlso">ibase_free_result()</a> - Free a result set</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>