📄 mysqli-stmt.attr-set.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Used to modify the behavior of 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="mysqli-stmt.attr-get.html">mysqli_stmt::attr_get</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli-stmt.bind-param.html">mysqli_stmt::bind_param</a></div> <div class="up"><a href="class.mysqli-stmt.html">MySQLi_STMT</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="mysqli-stmt.attr-set" class="refentry"> <div class="refnamediv"> <h1 class="refname">mysqli_stmt::attr_set</h1> <h1 class="refname">mysqli_stmt_attr_set</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">mysqli_stmt::attr_set</span> -- <span class="refname">mysqli_stmt_attr_set</span> — <span class="dc-title">Used to modify the behavior of a prepared statement</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <p class="para">Object oriented style (method):</p> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>mysqli_stmt::attr_set</b></b></span> ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$attr</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$mode</tt></span> )</div> <p class="para rdfs-comment">Procedural style:</p> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>mysqli_stmt_attr_set</b></b></span> ( <span class="methodparam"><span class="type"><span class="type mysqli_stmt">mysqli_stmt</span></span> <tt class="parameter">$stmt</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$attr</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$mode</tt></span> )</div> <p class="para rdfs-comment"> Used to modify the behavior of a prepared statement. This function may be called multiple times to set several attributes. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl><dt><span class="term"><i><tt class="parameter">stmt</tt></i></span><dd><p class="para">Procedural style only: A statement identifierreturned by <a href="mysqli.stmt-init.html" class="function">mysqli_stmt_init()</a>.</p></dd></dt><dt> <span class="term"><i><tt class="parameter">attr</tt></i></span> <dd> <p class="para"> The attribute that you want to set. It can have one of the following values: <table border="5"> <caption><b>Attribute values</b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Character</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH</td> <td colspan="1" rowspan="1" align="left"> If set to 1, causes <a href="mysqli-stmt.store-result.html" class="function">mysqli_stmt_store_result()</a> to update the metadata <i>MYSQL_FIELD->max_length</i> value. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">MYSQLI_STMT_ATTR_CURSOR_TYPE</td> <td colspan="1" rowspan="1" align="left"> Type of cursor to open for statement when <a href="mysqli-stmt.execute.html" class="function">mysqli_stmt_execute()</a> is invoked. <i><tt class="parameter">mode</tt></i> can be <i>MYSQLI_CURSOR_TYPE_NO_CURSOR</i> (the default) or <i>MYSQLI_CURSOR_TYPE_READ_ONLY</i>. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">MYSQLI_STMT_ATTR_PREFETCH_ROWS</td> <td colspan="1" rowspan="1" align="left"> Number of rows to fetch from server at a time when using a cursor. <i><tt class="parameter">mode</tt></i> can be in the range from 1 to the maximum value of unsigned long. The default is 1. </td> </tr> </tbody> </colgroup> </table> </p> <p class="para"> If you use the <i>MYSQLI_STMT_ATTR_CURSOR_TYPE</i> option with <i>MYSQLI_CURSOR_TYPE_READ_ONLY</i>, a cursor is opened for the statement when you invoke <a href="mysqli-stmt.execute.html" class="function">mysqli_stmt_execute()</a>. If there is already an open cursor from a previous <a href="mysqli-stmt.execute.html" class="function">mysqli_stmt_execute()</a> call, it closes the cursor before opening a new one. <a href="mysqli-stmt.reset.html" class="function">mysqli_stmt_reset()</a> also closes any open cursor before preparing the statement for re-execution. <a href="mysqli-stmt.free-result.html" class="function">mysqli_stmt_free_result()</a> closes any open cursor. </p> <p class="para"> If you open a cursor for a prepared statement, <a href="mysqli-stmt.store-result.html" class="function">mysqli_stmt_store_result()</a> is unnecessary. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">mode</tt></i></span> <dd> <p class="para">The value to assign to the attribute.</p> </dd> </dt> </dl> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqli-stmt.attr-get.html">mysqli_stmt::attr_get</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli-stmt.bind-param.html">mysqli_stmt::bind_param</a></div> <div class="up"><a href="class.mysqli-stmt.html">MySQLi_STMT</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 + -