<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Initializes a statement and returns a resource for use with mysqli_statement::prepare</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqlnduhconnection.sslset.html">MysqlndUhConnection::sslSet</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqlnduhconnection.storeresult.html">MysqlndUhConnection::storeResult</a></div> <div class="up"><a href="class.mysqlnduhconnection.html">MysqlndUhConnection</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mysqlnduhconnection.stmtinit" class="refentry"> <div class="refnamediv"> <h1 class="refname">MysqlndUhConnection::stmtInit</h1> <p class="verinfo">(PECL mysqlnd-uh >= 1.0.0-alpha)</p><p class="refpurpose"><span class="refname">MysqlndUhConnection::stmtInit</span> — <span class="dc-title">Initializes a statement and returns a resource for use with mysqli_statement::prepare</span></p> </div> <div class="refsect1 description" id="refsect1-mysqlnduhconnection.stmtinit-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">resource</span> <span class="methodname"><strong>MysqlndUhConnection::stmtInit</strong></span> ( <span class="methodparam"><span class="type"><span class="type mysqlnd_connection">mysqlnd_connection</span></span> <code class="parameter">$connection</code></span> )</div> <p class="para rdfs-comment"> Initializes a statement and returns a resource for use with mysqli_statement::prepare. </p> </div> <div class="refsect1 parameters" id="refsect1-mysqlnduhconnection.stmtinit-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">connection</code></em></span> <dd> <p class="para"> Mysqlnd connection handle. Do not modify! </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-mysqlnduhconnection.stmtinit-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Resource of type <em>Mysqlnd Prepared Statement (internal only - you must not modify it!)</em>. The documentation may also refer to such resources using the alias name <em>mysqlnd_prepared_statement</em>. </p> </div> <div class="refsect1 examples" id="refsect1-mysqlnduhconnection.stmtinit-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-1922"> <p><strong>Example #1 <span class="function"><strong>MysqlndUhConnection::stmtInit()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">proxy </span><span style="color: #007700">extends </span><span style="color: #0000BB">MysqlndUhConnection </span><span style="color: #007700">{<br /> public function </span><span style="color: #0000BB">stmtInit</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s(%s)\n"</span><span style="color: #007700">, </span><span style="color: #0000BB">__METHOD__</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_args</span><span style="color: #007700">(), </span><span style="color: #0000BB">true</span><span style="color: #007700">));<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$ret </span><span style="color: #007700">= </span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">stmtInit</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s returns %s\n"</span><span style="color: #007700">, </span><span style="color: #0000BB">__METHOD__</span><span style="color: #007700">, </span><span style="color: #0000BB">var_export</span><span style="color: #007700">(</span><span style="color: #0000BB">$ret</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">));<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$ret</span><span style="color: #007700">);<br /> return </span><span style="color: #0000BB">$ret</span><span style="color: #007700">;<br /> }<br />}<br /></span><span style="color: #0000BB">mysqlnd_uh_set_connection_proxy</span><span style="color: #007700">(new </span><span style="color: #0000BB">proxy</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">$mysqli </span><span style="color: #007700">= new </span><span style="color: #0000BB">mysqli</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"root"</span><span style="color: #007700">, </span><span style="color: #DD0000">""</span><span style="color: #007700">, </span><span style="color: #DD0000">"test"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #0000BB">$mysqli</span><span style="color: #007700">-></span><span style="color: #0000BB">prepare</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT 1 AS _one FROM DUAL"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt</span><span style="color: #007700">-></span><span style="color: #0000BB">execute</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$one </span><span style="color: #007700">= </span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$stmt</span><span style="color: #007700">-></span><span style="color: #0000BB">bind_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$one</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt</span><span style="color: #007700">-></span><span style="color: #0000BB">fetch</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$one</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> proxy::stmtInit(array ( 0 => NULL, )) resource(19) of type (Mysqlnd Connection) proxy::stmtInit returns NULL resource(246) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!)) int(1) </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-mysqlnduhconnection.stmtinit-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.mysqlnd-uh-set-connection-proxy.html" class="function" rel="rdfs-seeAlso">mysqlnd_uh_set_connection_proxy()</a> - Installs a proxy for mysqlnd connections</span> </li> <li class="member"> <span class="function"><a href="mysqli.stmt-init.html" class="function" rel="rdfs-seeAlso">mysqli_stmt_init()</a> - Initializes a statement and returns an object for use with mysqli_stmt_prepare</span> </li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqlnduhconnection.sslset.html">MysqlndUhConnection::sslSet</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqlnduhconnection.storeresult.html">MysqlndUhConnection::storeResult</a></div> <div class="up"><a href="class.mysqlnduhconnection.html">MysqlndUhConnection</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>