Mysql_fetch_array () function parameters
The mysql_fetch_array () function retrieves a row from the result set as an associated array, or an array of numbers, or both.
Returns the array generated based on the rows obtained from the result set. If no more rows exist, false is returned.
Mysql_fetch_array (data, array_type)
Array_type is as follows:
MYSQL_ASSOC-associated array
MYSQL_NUM-number array
MYSQL_BOTH-default. Generate join and numeric arrays at the same time
Mysql_fetch_rows () function parameters
The mysql_fetch_row () function retrieves a row from the result set as a numeric array.
Mysql_fetch_row (data)
From the above, they are all data pointers used. This data pointer is generated by the mysql_query () function, but there is a different parameter later. mysql_fetch_array () has the array_type parameter while mysql_fetch_rows () does not.
So what are the differences in usage? Let's take a look at the example below.
Both mysql_fetch_array () and mysql_fetch_rows () can obtain the field data of the database. For details about the differences, refer to the instance organized by www.111cn.net:
Example of the mysql_fetch_array () function
<? Php
$ SQL = "select * from user";
$ Query = mysql_query ($ SQL );
$ Result = mysql_fetch_array ($ query );
Echo $ result [name];
Echo $ resutlt [password];
?>
Example of mysql_fetch_rows () function
<? Php
$ SQL = "select * from user";
$ Query = mysql_query ($ SQL );
$ Result = mysql_fetch_rows ($ query );
Echo $ result [1];
Echo $ resutlt [2];
?>
Summary, Mysql_fetch_array () is an array and can be associated with an array, while mysql_fetch_rows is an object that cannot be associated with an array. The difference is here.