⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.odbc-execute.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Execute a prepared statement</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="function.odbc-exec.html">odbc_exec</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-fetch-array.html">odbc_fetch_array</a></div> <div class="up"><a href="ref.uodbc.html">ODBC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.odbc-execute" class="refentry"> <div class="refnamediv">  <h1 class="refname">odbc_execute</h1>  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">odbc_execute</span> &mdash; <span class="dc-title">Execute a prepared statement</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">bool</span> <span class="methodname"><b><b>odbc_execute</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$result_id</tt></span>   [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$parameters_array</tt></span>  ] )</div>  <p class="para rdfs-comment">   Executes a statement prepared with <a href="function.odbc-prepare.html" class="function">odbc_prepare()</a>.  </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">       The result id <a href="language.types.resource.html" class="type resource">resource</a>, from <a href="function.odbc-prepare.html" class="function">odbc_prepare()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">parameters_array</tt></i></span>     <dd>      <p class="para">       Parameters in <i><tt class="parameter">parameter_array</tt></i> will be       substituted for placeholders in the prepared statement in order.       Elements of this array will be converted to strings by calling this       function.      </p>      <p class="para">       Any parameters in <i><tt class="parameter">parameter_array</tt></i> which       start and end with single quotes will be taken as the name of a       file to read and send to the database server as the data for the       appropriate placeholder.      </p>      <span class="simpara">       If you wish to store a string which actually begins and ends with       single quotes, you must add a space or other non-single-quote character       to the beginning or end of the parameter, which will prevent the       parameter from being taken as a file name. If this is not an option,       then you must use another mechanism to store the string, such as       executing the query directly with <a href="function.odbc-exec.html" class="function">odbc_exec()</a>).      </span>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>odbc_execute()</b> and <a href="function.odbc-prepare.html" class="function">odbc_prepare()</a> example</b></p>    <div class="example-contents"><p>     In the following code, <var class="varname">$success</var> will only be     <b><tt>TRUE</tt></b> if all three parameters to myproc are IN parameters:    </p></div>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$stmt&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">odbc_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'CALL&nbsp;myproc(?,?,?)'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$success&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">odbc_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$stmt</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p>  <p class="para">   If you need to call a stored procedure using INOUT or OUT parameters,   the recommended workaround is to use a native extension for your database   (for example, <a href="ref.mssql.html" class="link">mssql</a> for MS SQL Server,   or <a href="ref.mssql.html" class="link">oci8</a> for Oracle).  </p> </div> <div class="refsect1 changelog">  <h3 class="title">ChangeLog</h3>  <p class="para">   <table class="informaltable">    <colgroup>     <thead valign="middle">      <tr valign="middle">       <th colspan="1">Version</th>       <th colspan="1">Description</th>      </tr>     </thead>     <tbody valign="middle" class="tbody">      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">4.2.0</td>       <td colspan="1" rowspan="1" align="left">        File reading is now subject to <a href="features.safe-mode.html#ini.safe-mode" class="link">safe mode</a> and        <a href="features.safe-mode.html#ini.open-basedir" class="link">open-basedir</a> restrictions        in <i><tt class="parameter">parameters_array</tt></i>.       </td>      </tr>      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">4.1.1</td>       <td colspan="1" rowspan="1" align="left">        <a href="features.remote-files.html" class="link">Remote files</a>        are no longer supported in <i><tt class="parameter">parameters_array</tt></i>.       </td>      </tr>     </tbody>    </colgroup>   </table>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.odbc-prepare.html" class="function" rel="rdfs-seeAlso">odbc_prepare()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-exec.html">odbc_exec</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-fetch-array.html">odbc_fetch_array</a></div> <div class="up"><a href="ref.uodbc.html">ODBC 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 + -