Home > Backend Development > PHP Tutorial > Detailed explanation of how to use mysql_fetch_array() to obtain the current row data_PHP tutorial

Detailed explanation of how to use mysql_fetch_array() to obtain the current row data_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:09:02
Original
1021 people have browsed it

Similar to mysql_fetch_row(), the function mysql_fetch_array() also obtains the current row data in the result set and automatically slides to the next row after being called. Its definition is as follows.

Copy code The code is as follows:

array mysql_fetch_array(int result, int [result_type])

The parameter description is as follows.
(1) result: The result identifier returned by the function mysql_query() or mysql_db_query(), used to specify the SQL statement type of the data to be obtained.
(2) result_type: used to specify the result set type, optional, the value range is the PHP constant set {MYSQL_ASSOC, MYSQL_NUM, MYSQL_BOTH}.
The return value of the function is as follows.
Success: An array that contains the current row data information in the query result set. The array subscript ranges from 0 to the number of record attributes −1, the i-th in the array The element value is the value on the i-th attribute of the record. At the same time, you can use the attribute name to get the value of the attribute.
Failed: false.
The following example uses mysql_fetch_array() to obtain book information with a price of not less than 20 in the Computers data table.
Copy code The code is as follows:

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template