📄 function.ifx-affected-rows.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Get number of rows affected by a query</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="ref.ifx.html">Informix Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ifx-blobinfile-mode.html">ifx_blobinfile_mode</a></div> <div class="up"><a href="ref.ifx.html">Informix Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ifx-affected-rows" class="refentry"> <div class="refnamediv"> <h1 class="refname">ifx_affected_rows</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">ifx_affected_rows</span> — <span class="dc-title">Get number of rows affected by a query</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>ifx_affected_rows</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$result_id</tt></span> )</div> <p class="para rdfs-comment"> Returns the number of rows affected by a query associated with <i><tt class="parameter">result_id</tt></i>. </p> <p class="para"> For inserts, updates and deletes the number is the real number (sqlerrd[2]) of affected rows. For selects it is an estimate (sqlerrd[0]). Don't rely on it. The database server can never return the actual number of rows that will be returned by a SELECT because it has not even begun fetching them at this stage (just after the "PREPARE" when the optimizer has determined the query plan). </p> <p class="para"> Useful after <a href="function.ifx-prepare.html" class="function">ifx_prepare()</a> to limit queries to reasonable result sets. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">result_id</tt></i></span> <dd> <p class="para"> A valid result id returned by <a href="function.ifx-query.html" class="function">ifx_query()</a> or <a href="function.ifx-prepare.html" class="function">ifx_prepare()</a>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the number of rows as an integer. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 Informix affected rows</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$rid </span><span style="color: #007700">= </span><span style="color: #0000BB">ifx_prepare</span><span style="color: #007700">(</span><span style="color: #DD0000">"select * from emp<br /> where name like " </span><span style="color: #007700">. </span><span style="color: #0000BB">$name</span><span style="color: #007700">, </span><span style="color: #0000BB">$connid</span><span style="color: #007700">);<br />if (! </span><span style="color: #0000BB">$rid</span><span style="color: #007700">) {<br /> </span><span style="color: #FF8000">/* ... error ... */<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$rowcount </span><span style="color: #007700">= </span><span style="color: #0000BB">ifx_affected_rows</span><span style="color: #007700">(</span><span style="color: #0000BB">$rid</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$rowcount </span><span style="color: #007700">> </span><span style="color: #0000BB">1000</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">printf </span><span style="color: #007700">(</span><span style="color: #DD0000">"Too many rows in result set (%d)\n<br />"</span><span style="color: #007700">, </span><span style="color: #0000BB">$rowcount</span><span style="color: #007700">);<br /> die (</span><span style="color: #DD0000">"Please restrict your query<br />\n"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.ifx-num-rows.html" class="function" rel="rdfs-seeAlso">ifx_num_rows()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.ifx.html">Informix Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ifx-blobinfile-mode.html">ifx_blobinfile_mode</a></div> <div class="up"><a href="ref.ifx.html">Informix Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -