MySQL function library: mysql_fetch_object

Source: Internet
Author: User
Keywords mysql_fetch_object mysql function Library php Chinese function manual
Tags aliyun function function library html http mysql mysql function library mysql_fetch_array

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 ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.