Sophie

Sophie

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

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>Returns the ID of the last inserted row or sequence value</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pdo.intransaction.html">PDO::inTransaction</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdo.prepare.html">PDO::prepare</a></div>
 <div class="up"><a href="class.pdo.html">PDO</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="pdo.lastinsertid" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PDO::lastInsertId</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PECL pdo &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO::lastInsertId</span> &mdash; <span class="dc-title">
   Returns the ID of the last inserted row or sequence value
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pdo.lastinsertid-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>PDO::lastInsertId</strong></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
  ] )</div>


  <p class="para rdfs-comment">
   Returns the ID of the last inserted row, or the last value from a
   sequence object, depending on the underlying driver. For example,
   <a href="ref.pdo-pgsql.html" class="link">PDO_PGSQL</a> requires you to specify the name of
   a sequence object for the <em><code class="parameter">name</code></em> parameter.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    This method may not return a meaningful or consistent result across
    different PDO drivers, because the underlying database may not even
    support the notion of auto-increment fields or sequences.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-pdo.lastinsertid-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

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

      <p class="para">
       Name of the sequence object from which the ID should be returned.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-pdo.lastinsertid-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If a sequence name was not specified for the <em><code class="parameter">name</code></em>
   parameter,  <span class="function"><strong>PDO::lastInsertId()</strong></span> returns a
   string representing the row ID of the last row that was inserted into
   the database.
  </p>
  <p class="para">
   If a sequence name was specified for the <em><code class="parameter">name</code></em>
   parameter,  <span class="function"><strong>PDO::lastInsertId()</strong></span> returns a
   string representing the last value retrieved from the specified sequence
   object.
  </p>
  <p class="para">
   If the PDO driver does not support this capability,
    <span class="function"><strong>PDO::lastInsertId()</strong></span> triggers an
   <em>IM001</em> SQLSTATE.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pdo.intransaction.html">PDO::inTransaction</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pdo.prepare.html">PDO::prepare</a></div>
 <div class="up"><a href="class.pdo.html">PDO</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>