<!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>Fetches the next row and returns it as an object.</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pdostatement.fetchcolumn.html">PDOStatement::fetchColumn</a></div> <div class="next" style="text-align: right; float: right;"><a href="pdostatement.getattribute.html">PDOStatement::getAttribute</a></div> <div class="up"><a href="class.pdostatement.html">PDOStatement</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="pdostatement.fetchobject" class="refentry"> <div class="refnamediv"> <h1 class="refname">PDOStatement::fetchObject</h1> <p class="verinfo">(PHP 5 >= 5.1.0, PECL pdo >= 0.2.4)</p><p class="refpurpose"><span class="refname">PDOStatement::fetchObject</span> — <span class="dc-title">Fetches the next row and returns it as an object.</span></p> </div> <div class="refsect1 description" id="refsect1-pdostatement.fetchobject-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>PDOStatement::fetchObject</strong></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> <p class="para rdfs-comment"> Fetches the next row and returns it as an object. This function is an alternative to <span class="function"><a href="pdostatement.fetch.html" class="function">PDOStatement::fetch()</a></span> with <strong><code>PDO::FETCH_CLASS</code></strong> or <strong><code>PDO::FETCH_OBJ</code></strong> style. </p> </div> <div class="refsect1 parameters" id="refsect1-pdostatement.fetchobject-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">class_name</code></em></span> <dd> <p class="para"> Name of the created class. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">ctor_args</code></em></span> <dd> <p class="para"> Elements of this array are passed to the constructor. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-pdostatement.fetchobject-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an instance of the required class with property names that correspond to the column names or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-pdostatement.fetchobject-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="pdostatement.fetch.html" class="function" rel="rdfs-seeAlso">PDOStatement::fetch()</a> - Fetches the next row from a result set</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="pdostatement.fetchcolumn.html">PDOStatement::fetchColumn</a></div> <div class="next" style="text-align: right; float: right;"><a href="pdostatement.getattribute.html">PDOStatement::getAttribute</a></div> <div class="up"><a href="class.pdostatement.html">PDOStatement</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>