| This article describes the usage of the mysql_fetch_array () function in php. it returns the data query results in the form of arrays. For more information, see.
Php Data Query result function: mysql_fetch_array () function. Returns the data query result in an array.
Syntax: array mysql_fetch_array (int result, int [result_typ]);
Returned value: Array Function type: database function
This function is used to split the query result into array variables. If the result contains no data, false is returned. This function is the enhancement function of mysql_fetch_row (). In addition to putting the returned column and numeric index into the array, you can also put the text index into the array.
If multiple returned fields are the same text names, the last field is valid. Solution: Use a digital index or use an alias (alias) for these columns with the same name ).
Note: the processing speed of using this function is actually not slower than that of the mysql_fetch_row () function. it depends on the function to be used. The result_typ parameter is a constant value and has the following constants: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH.
Let's look at an example. Output all rows of the_id and a_name fields in the table of the database. Code:
|