Sophie

Sophie

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

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>Open a connection to a database</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ibase-commit.html">ibase_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ibase-db-info.html">ibase_db_info</a></div>
 <div class="up"><a href="ref.ibase.html">Firebird/InterBase Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ibase-connect" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ibase_connect</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">ibase_connect</span> &mdash; <span class="dc-title">Open a connection to a database</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ibase-connect-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>ibase_connect</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$database</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$username</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$buffers</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$dialect</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$role</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$sync</code></span>
  ]]]]]]]] )</div>

  <p class="para rdfs-comment">
   Establishes a connection to an Firebird/InterBase server.
  </p>
  <p class="para">
   In case a second call is made to  <span class="function"><strong>ibase_connect()</strong></span> with
   the same arguments, no new link will be established, but instead, the link
   identifier of the already opened link will be returned. The link to the
   server will be closed as soon as the execution of the script ends, unless
   it&#039;s closed earlier by explicitly calling  <span class="function"><a href="function.ibase-close.html" class="function">ibase_close()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ibase-connect-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

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

      <p class="para">
       The <em><code class="parameter">database</code></em> argument has to be a valid path to
       database file on the server it resides on. If the server is not local,
       it must be prefixed with either &#039;hostname:&#039; (TCP/IP), &#039;//hostname/&#039;
       (NetBEUI), depending on the connection
       protocol used.   
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       The user name. Can be set with the
       <em>ibase.default_user</em> <var class="filename">php.ini</var> directive.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       The password for <em><code class="parameter">username</code></em>. Can be set with the
       <em>ibase.default_password</em> <var class="filename">php.ini</var> directive.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       <em><code class="parameter">charset</code></em> is the default character set for a
       database.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       <em><code class="parameter">buffers</code></em> is the number of database buffers to
       allocate for the server-side cache. If 0 or omitted, server chooses
       its own default.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       <em><code class="parameter">dialect</code></em> selects the default SQL dialect for any
       statement executed within a connection, and it defaults to the highest
       one supported by client libraries.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       Functional only with InterBase 5 and up.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ibase-connect-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an Firebird/InterBase link identifier on success, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.ibase-connect-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   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"><a href="function.ibase-query.html" class="function">ibase_query()</a></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-connect-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1106">
    <p><strong>Example #1  <span class="function"><strong>ibase_connect()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$host&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'localhost:/path/to/your.gdb'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$dbh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$host</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$username</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'SELECT&nbsp;*&nbsp;FROM&nbsp;tblname'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$sth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">);<br />while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ibase_fetch_object</span><span style="color: #007700">(</span><span style="color: #0000BB">$sth</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">email</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">ibase_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$sth</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ibase_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ibase-connect-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.ibase-pconnect.html" class="function" rel="rdfs-seeAlso">ibase_pconnect()</a> - Open a persistent connection to an InterBase database</span></li>
    <li class="member"> <span class="function"><a href="function.ibase-close.html" class="function" rel="rdfs-seeAlso">ibase_close()</a> - Close a connection to an InterBase database</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.ibase-commit.html">ibase_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ibase-db-info.html">ibase_db_info</a></div>
 <div class="up"><a href="ref.ibase.html">Firebird/InterBase Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>