pdo.lastinsertid.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 100 行

HTML
100
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Returns the ID of the last inserted row or sequence value</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pdo.getavailabledrivers.html">PDO::getAvailableDrivers</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:0.1-1.0.3)</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">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">string</span> <span class="methodname"><b><b>PDO::lastInsertId</b></b></span>    ([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$name</tt></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,   <b>PDO_PGSQL()</b> requires you to specify the name of   a sequence object for the <i><tt class="parameter">name</tt></i> parameter.  </p>  <blockquote><p><b class="note">Note</b>:        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.   <br />  </p></blockquote> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">name</tt></i></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">  <h3 class="title">Return Values</h3>  <p class="para">   If a sequence name was not specified for the <i><tt class="parameter">name</tt></i>   parameter, <b>PDO::lastInsertId()</b> 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 <i><tt class="parameter">name</tt></i>   parameter, <b>PDO::lastInsertId()</b> 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,   <b>PDO::lastInsertId()</b> triggers an   <i>IM001</i> SQLSTATE.  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pdo.getavailabledrivers.html">PDO::getAvailableDrivers</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>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?