MySQL function library: mysql_fetch_array

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

Mysql_fetch_array

(PHP3, PHP4)

Mysql_fetch_array---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Get the array results after the query

Syntax: array mysql_fetch_array (int result [, int result_type])

Description:

Returns an array that is equivalent to getting a column, and returns False if no more columns are returned.

Mysql_fetch_array () is an extended version of Mysql_fetch_row () that, in addition to storing data in the numeric index of an array, can store data in a grouped index, using a field name as an index value.

If the result of the query is that more than two fields are the same name, the last field is valid, and in order to access the field of the same name, you must give the field an individual name.

Select T1.f1 as Foo t2.f1 as bar from T1, T2

The second parameter of the mysql_fetch_array () Result_type is required, Result_type is constant and has the following values: Mysql_assoc,mysql_num and Mysql_both ( This is new in PHP3.0.7)

For more information please refer to: mysql_fetch_row ()

Example:

<?php

Mysql_connect ($host, $user, $password);

$result = mysql_db_query ("Database", "SELECT * from table");

while ($row = Mysql_fetch_array ($result)) {

echo $row ["user_id"];

echo $row ["FullName"];

}

Mysql_free_result ($result);

?>

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.