php-doc-en/reference/pdo/functions/PDO-lastInsertId.xml
Mehdi Achour 3782dbb92c Document PDO with classsynopsis and fix all links
# Also rollback a change that shouldn't have make it in the last commit


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@226684 c90b9560-bf6c-de11-be94-00142212c4b1
2007-01-07 20:57:48 +00:00

93 lines
2.7 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.12 $ -->
<refentry id="function.PDO-lastInsertId">
<refnamediv>
<refname>PDO->lastInsertId()</refname>
<refpurpose>
Returns the ID of the last inserted row or sequence value
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>PDO</classname></ooclass>
<methodsynopsis>
<type>string</type><methodname>lastInsertId</methodname>
<methodparam choice="opt"><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
Returns the ID of the last inserted row, or the last value from a
sequence object, depending on the underlying driver. For example,
<function>PDO_PGSQL</function> requires you to specify the name of
a sequence object for the <parameter>name</parameter> parameter.
</para>
<note>
<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.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
Name of the sequence object from which the ID should be returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If a sequence name was not specified for the <parameter>name</parameter>
parameter, <xref linkend="function.PDO-lastInsertId" /> returns a
string representing the row ID of the last row that was inserted into
the database.
</para>
<para>
If a sequence name was specified for the <parameter>name</parameter>
parameter, <xref linkend="function.PDO-lastInsertId" /> returns a
string representing the last value retrieved from the specified sequence
object.
</para>
<para>
If the PDO driver does not support this capability,
<xref linkend="function.PDO-lastInsertId" /> triggers an
<literal>IM001</literal> SQLSTATE.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->