PHP mysqli_fetch_object() Function
Return the current row in the result set, then output the value of each field:
name,$obj->url);
echo "
";
}
// Release the result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
Definition and Usage
The mysqli_fetch_object() function fetches the current row from a result set and returns it as an object.
**Note:** The field names returned by this function are case-sensitive.
Syntax
mysqli_fetch_object(
result,classname,params
)
;
| Parameters | Description |
|---|---|
| result | Required. Specifies the result set identifier returned by mysqli_query(), mysqli_store_result(), or mysqli_use_result(). |
| classname | Optional. Specifies the name of the class to instantiate, set properties on and return. |
| params | Optional. Specifies an array of arguments to pass to the classname object constructor. |
Technical Details
| Return Value: | Returns an object with string properties corresponding to the fetched row, or NULL if there are no more rows in the result set. |
|---|---|
| PHP Version: | 5+ |
| Changelog: | The ability to return as different objects was added in PHP 5.0.0. |
PHP MySQLi Reference Manual