<!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>Constructs a new mysqli_stmt object</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mysqli-stmt.close.html">mysqli_stmt::close</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli-stmt.data-seek.html">mysqli_stmt::data_seek</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.construct" class="refentry"> <div class="refnamediv"> <h1 class="refname">mysqli_stmt::__construct</h1> <p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mysqli_stmt::__construct</span> — <span class="dc-title">Constructs a new <a href="class.mysqli-stmt.html" class="classname">mysqli_stmt</a> object</span></p> </div> <div class="refsect1 description" id="refsect1-mysqli-stmt.construct-description"> <h3 class="title">Description</h3> <div class="constructorsynopsis dc-description"> <span class="methodname"><strong>mysqli_stmt::__construct</strong></span> ( <span class="methodparam"><span class="type"><a href="class.mysqli.html" class="type mysqli">mysqli</a></span> <code class="parameter">$link</code></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span> ] )</div> <p class="para rdfs-comment"> This method constructs a new <a href="class.mysqli-stmt.html" class="classname">mysqli_stmt</a> object. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> In general, you should use either <span class="function"><a href="mysqli.prepare.html" class="function">mysqli_prepare()</a></span> or <span class="function"><a href="mysqli.stmt-init.html" class="function">mysqli_stmt_init()</a></span> to create a <a href="class.mysqli-stmt.html" class="classname">mysqli_stmt</a> object, rather than directly instantiating the object with <em>new mysqli_stmt</em>. This method (and the ability to directly instantiate <a href="class.mysqli-stmt.html" class="classname">mysqli_stmt</a> objects) may be deprecated and removed in the future. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-mysqli-stmt.construct-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter"> link</code></dt> <dd> <p class="para">Procedural style only: A link identifier returned by <span class="function"><a href="function.mysqli-connect.html" class="function">mysqli_connect()</a></span> or <span class="function"><a href="mysqli.init.html" class="function">mysqli_init()</a></span> </p></dd> <dt> <code class="parameter">query</code></dt> <dd> <p class="para"> The query, as a string. If this parameter is omitted, then the constructor behaves identically to <span class="function"><a href="mysqli.stmt-init.html" class="function">mysqli_stmt_init()</a></span>, if provided, then it behaves as per <span class="function"><a href="mysqli.prepare.html" class="function">mysqli_prepare()</a></span>. </p> </dd> </dl> </p> </div> <div class="refsect1 seealso" id="refsect1-mysqli-stmt.construct-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="mysqli.prepare.html" class="function" rel="rdfs-seeAlso">mysqli_prepare()</a> - Prepare an SQL statement for execution</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="mysqli-stmt.close.html">mysqli_stmt::close</a></div> <div class="next" style="text-align: right; float: right;"><a href="mysqli-stmt.data-seek.html">mysqli_stmt::data_seek</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>