Mysql_fetch_object
(PHP3, PHP4)
Mysql_fetch_object---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Get the result of the object after the query
Syntax: Object mysql_fetch_object (int result [, int Result_typ])
Description:
Returns an object that is equivalent to getting a column, and returns fales if no more columns are returned.
Mysql_fetch_object () is similar to mysql_fetch_array (), one of the differences is that the function returns an object instead of an array, which means that you can access the data with a field name and not at their offset (offset) ( Number is illegal property name)
Non-required option result_type is a constant and can be a value of: Mysql_assoc, Mysql_num, Mysql_both.
This function is the same as mysql_fetch_array () and is similar in speed to Mysql_fetch_row ().
Example:
<?php
Mysql_connect ($host, $user, $password);
$result = mysql_db_query ("Database", "SELECT * from table");
while ($row = Mysql_fetch_object ($result)) {
Echo $row->user_id; Echo $row->fullname;
}
Mysql_free_result ($result);
?>
Reference: Mysql_fetch_array () mysql_fetch_row ()