Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10217

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>Fetch extended error information associated with the last operation on the statement handle</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pdostatement.errorcode.html">PDOStatement::errorCode</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdostatement.execute.html">PDOStatement::execute</a></div>
 <div class="up"><a href="class.pdostatement.html">PDOStatement</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="pdostatement.errorinfo" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PDOStatement::errorInfo</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PECL pdo &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDOStatement::errorInfo</span> &mdash; <span class="dc-title">
   Fetch extended error information associated with the last operation on the statement handle
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pdostatement.errorinfo-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>PDOStatement::errorInfo</strong></span>
    ( <span class="methodparam">void</span>
   )</div>


 </div>


 <div class="refsect1 returnvalues" id="refsect1-pdostatement.errorinfo-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <span class="function"><strong>PDOStatement::errorInfo()</strong></span> returns an array of
   error information about the last operation performed by this
   statement handle. The array consists of the following fields:
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Element</th>
       <th>Information</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>0</td>
       <td>SQLSTATE error code (a five characters alphanumeric identifier defined
               in the ANSI SQL standard).</td>
      </tr>

      <tr>
       <td>1</td>
       <td>Driver specific error code.</td>
      </tr>

      <tr>
       <td>2</td>
       <td>Driver specific error message.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-pdostatement.errorinfo-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-944"><p><strong>Example #1 Displaying errorInfo() fields for a PDO_ODBC connection to a DB2 database</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Provoke&nbsp;an&nbsp;error&nbsp;--&nbsp;the&nbsp;BONES&nbsp;table&nbsp;does&nbsp;not&nbsp;exist&nbsp;*/<br /></span><span style="color: #0000BB">$sth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepare</span><span style="color: #007700">(</span><span style="color: #DD0000">'SELECT&nbsp;skull&nbsp;FROM&nbsp;bones'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$sth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /><br />echo&nbsp;</span><span style="color: #DD0000">"\nPDOStatement::errorInfo():\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$sth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorInfo</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$arr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
PDOStatement::errorInfo():
Array
(
    [0] =&gt; 42S02
    [1] =&gt; -204
    [2] =&gt; [IBM][CLI Driver][DB2/LINUX] SQL0204N  &quot;DANIELS.BONES&quot; is an undefined name.  SQLSTATE=42704
)
</pre></div>
    </div>
   </div>
  </p>

 </div>


 <div class="refsect1 seealso" id="refsect1-pdostatement.errorinfo-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="pdo.errorcode.html" class="function" rel="rdfs-seeAlso">PDO::errorCode()</a> - Fetch the SQLSTATE associated with the last operation on the database handle</span></li>
    <li class="member"> <span class="function"><a href="pdo.errorinfo.html" class="function" rel="rdfs-seeAlso">PDO::errorInfo()</a> - Fetch extended error information associated with the last operation on the database handle</span></li>
    <li class="member"> <span class="function"><a href="pdostatement.errorcode.html" class="function" rel="rdfs-seeAlso">PDOStatement::errorCode()</a> - Fetch the SQLSTATE associated with the last operation on the statement handle</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="pdostatement.errorcode.html">PDOStatement::errorCode</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdostatement.execute.html">PDOStatement::execute</a></div>
 <div class="up"><a href="class.pdostatement.html">PDOStatement</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>