<!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>The PDOStatement class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pdo.setattribute.html">PDO::setAttribute</a></div> <div class="next" style="text-align: right; float: right;"><a href="pdostatement.bindcolumn.html">PDOStatement::bindColumn</a></div> <div class="up"><a href="book.pdo.html">PDO</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.pdostatement" class="reference"> <h1 class="title">The PDOStatement class</h1> <div class="partintro"><p class="verinfo">(PHP 5 >= 5.1.0, PECL pdo >= 1.0.0)</p> <div class="section" id="pdostatement.intro"> <h2 class="title">Introduction</h2> <p class="para"> Represents a prepared statement and, after the statement is executed, an associated result set. </p> </div> <div class="section" id="pdostatement.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">PDOStatement</strong> </span> <span class="oointerface">implements <span class="interfacename"><a href="class.traversable.html" class="interfacename">Traversable</a></span> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div> <div class="fieldsynopsis"><span class="modifier">readonly</span> <span class="type">string</span> <var class="varname"><a href="class.pdostatement.html#pdostatement.props.querystring">$<var class="varname">queryString</var></a></var>;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.bindcolumn.html" class="methodname">bindColumn</a></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$column</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter reference">&$param</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$maxlen</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$driverdata</code></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.bindparam.html" class="methodname">bindParam</a></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$parameter</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter reference">&$variable</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$data_type</code><span class="initializer"> = PDO::PARAM_STR</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$driver_options</code></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.bindvalue.html" class="methodname">bindValue</a></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$parameter</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$data_type</code><span class="initializer"> = PDO::PARAM_STR</span></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.closecursor.html" class="methodname">closeCursor</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="pdostatement.columncount.html" class="methodname">columnCount</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="pdostatement.debugdumpparams.html" class="methodname">debugDumpParams</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="pdostatement.errorcode.html" class="methodname">errorCode</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="pdostatement.errorinfo.html" class="methodname">errorInfo</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.execute.html" class="methodname">execute</a></span> ([ <span class="methodparam"><span class="type">array</span> <code class="parameter">$input_parameters</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="pdostatement.fetch.html" class="methodname">fetch</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$fetch_style</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$cursor_orientation</code><span class="initializer"> = PDO::FETCH_ORI_NEXT</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$cursor_offset</code><span class="initializer"> = 0</span></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="pdostatement.fetchall.html" class="methodname">fetchAll</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$fetch_style</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$fetch_argument</code></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ctor_args</code><span class="initializer"> = array()</span></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="pdostatement.fetchcolumn.html" class="methodname">fetchColumn</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$column_number</code><span class="initializer"> = 0</span></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="pdostatement.fetchobject.html" class="methodname">fetchObject</a></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$class_name</code><span class="initializer"> = "stdClass"</span></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ctor_args</code></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="pdostatement.getattribute.html" class="methodname">getAttribute</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$attribute</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="pdostatement.getcolumnmeta.html" class="methodname">getColumnMeta</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$column</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.nextrowset.html" class="methodname">nextRowset</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="pdostatement.rowcount.html" class="methodname">rowCount</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.setattribute.html" class="methodname">setAttribute</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$attribute</code></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="pdostatement.setfetchmode.html" class="methodname">setFetchMode</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span> )</div> }</div> </div> <div class="section" id="pdostatement.props"> <h2 class="title">Properties</h2> <dl> <dt id="pdostatement.props.querystring"> <span class="term"><var class="varname"><var class="varname">queryString</var></var></span> <dd> <p class="para"> Used query string. </p> </dd> </dt> </dl> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="pdostatement.bindcolumn.html">PDOStatement::bindColumn</a> — Bind a column to a PHP variable</li><li><a href="pdostatement.bindparam.html">PDOStatement::bindParam</a> — Binds a parameter to the specified variable name</li><li><a href="pdostatement.bindvalue.html">PDOStatement::bindValue</a> — Binds a value to a parameter</li><li><a href="pdostatement.closecursor.html">PDOStatement::closeCursor</a> — Closes the cursor, enabling the statement to be executed again.</li><li><a href="pdostatement.columncount.html">PDOStatement::columnCount</a> — Returns the number of columns in the result set</li><li><a href="pdostatement.debugdumpparams.html">PDOStatement::debugDumpParams</a> — Dump an SQL prepared command</li><li><a href="pdostatement.errorcode.html">PDOStatement::errorCode</a> — Fetch the SQLSTATE associated with the last operation on the statement handle</li><li><a href="pdostatement.errorinfo.html">PDOStatement::errorInfo</a> — Fetch extended error information associated with the last operation on the statement handle</li><li><a href="pdostatement.execute.html">PDOStatement::execute</a> — Executes a prepared statement</li><li><a href="pdostatement.fetch.html">PDOStatement::fetch</a> — Fetches the next row from a result set</li><li><a href="pdostatement.fetchall.html">PDOStatement::fetchAll</a> — Returns an array containing all of the result set rows</li><li><a href="pdostatement.fetchcolumn.html">PDOStatement::fetchColumn</a> — Returns a single column from the next row of a result set</li><li><a href="pdostatement.fetchobject.html">PDOStatement::fetchObject</a> — Fetches the next row and returns it as an object.</li><li><a href="pdostatement.getattribute.html">PDOStatement::getAttribute</a> — Retrieve a statement attribute</li><li><a href="pdostatement.getcolumnmeta.html">PDOStatement::getColumnMeta</a> — Returns metadata for a column in a result set</li><li><a href="pdostatement.nextrowset.html">PDOStatement::nextRowset</a> — Advances to the next rowset in a multi-rowset statement handle</li><li><a href="pdostatement.rowcount.html">PDOStatement::rowCount</a> — Returns the number of rows affected by the last SQL statement</li><li><a href="pdostatement.setattribute.html">PDOStatement::setAttribute</a> — Set a statement attribute</li><li><a href="pdostatement.setfetchmode.html">PDOStatement::setFetchMode</a> — Set the default fetch mode for this statement</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pdo.setattribute.html">PDO::setAttribute</a></div> <div class="next" style="text-align: right; float: right;"><a href="pdostatement.bindcolumn.html">PDOStatement::bindColumn</a></div> <div class="up"><a href="book.pdo.html">PDO</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>