Home >Database >Mysql Tutorial >mysql_fetch_array vs mysql_fetch_assoc vs mysql_fetch_object?
These mysql_* functions are deprecated and other functions may be used to provide better security and functionality.
Note: As an alternative, you can use _assoc or _row.
This function returns an associative array of strings corresponding to the rows retrieved, or FALSE if there are no more rows. The associativity array tells us the key-value pairs, whereas the keys tell us any column names and the values tell us the row values.
Here we can map column names to keys and values to rows. For example.
Key is ID and value is corresponding name.
The name of this function indicates that it returns an array. It gets the result rows as an associative array, a numeric array, or both. Its keys have both numeric and string values.
This function returns rows as objects and does not return arrays.
The above is the detailed content of mysql_fetch_array vs mysql_fetch_assoc vs mysql_fetch_object?. For more information, please follow other related articles on the PHP Chinese website!