Oracle 5.0 Reference Manual page 2287

Table of Contents

Advertisement

also
Alternatives to this function include:
mysqli_fetch_object
PDOStatement::fetch(PDO::FETCH_OBJ)
Description
object mysql_fetch_object(
resource result,
string class_name,
array params);
Returns an object with properties that correspond to the fetched row and moves the internal data
pointer ahead.
Parameters
result
class_name
params
Return Values
Returns an object with string properties that correspond to the fetched row, or
more rows.
Changelog
Version
5.0.0
Examples
Example 20.45.
mysql_fetch_object
<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->fullname;
}
mysql_free_result($result);
?>
Example 20.46.
mysql_fetch_object
<?php
class foo {
public $name;
}
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
Original MySQL API (Mysql)
MySQL: choosing an API
The result resource that is being evaluated. This result comes from
a call to mysql_query.
The name of the class to instantiate, set the properties of and return.
If not specified, a
An optional array of parameters to pass to the constructor for
class_name
example
example
2267
guide and
related FAQ
object is returned.
stdClass
objects.
Description
Added the ability to return as a different object.
for more information.
if there are no
FALSE

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents