What parameters should be considered when using mysql_fetch_array() to retrieve data from a database in PHP?

When using mysql_fetch_array() to retrieve data from a database in PHP, it is important to consider the parameters that are passed to the function. The first parameter should be the result set returned by a query, and the second parameter should specify the type of array to return (e.g., MYSQL_ASSOC, MYSQL_NUM, or MYSQL_BOTH). Additionally, it is crucial to check if the query was successful before attempting to fetch data to avoid errors.

// Assuming $result is the result set returned by a query
if ($result) {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        // Process each row of data here
    }
} else {
    echo "Error: Unable to fetch data from database.";
}