Source of: /manual/en/pdostatement.fetchobject.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.pdostatement.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'pdostatement.fetchobject.php',
1 => 'PDOStatement->fetchObject',
),
'up' =>
array (
0 => 'class.pdostatement.php',
1 => 'The PDOStatement class',
),
'prev' =>
array (
0 => 'pdostatement.fetchcolumn.php',
1 => 'PDOStatement->fetchColumn',
),
'next' =>
array (
0 => 'pdostatement.getattribute.php',
1 => 'PDOStatement->getAttribute',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<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>
<a name="pdostatement.fetchobject.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type"><a href="language.pseudo-types.php#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><b>PDOStatement::fetchObject</b></span>
([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$class_name</tt></span>
[, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$ctor_args</tt></span>
]] )</div>
<p class="para rdfs-comment">
Fetches the next row and returns it as an object. This function is an
alternative to <a href="pdostatement.fetch.php" class="function">PDOStatement::fetch()</a> with
<b><tt class="constant">PDO::FETCH_CLASS</tt></b> or
<b><tt class="constant">PDO::FETCH_OBJ</tt></b> style.
</p>
</div>
<a name="pdostatement.fetchobject.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">class_name</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Name of the created class, defaults to <i>stdClass</i>.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">ctor_args</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Elements of this array are passed to the constructor.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="pdostatement.fetchobject.returnvalues"></a><div class="refsect1 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 <b><tt class="constant">FALSE</tt></b> on failure.
</p>
</div>
<a name="pdostatement.fetchobject.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="pdostatement.fetch.php" class="function" rel="rdfs-seeAlso">PDOStatement::fetch()</a> - Fetches the next row from a result set</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>