What is the purpose of using mysql_fetch_array() in PHP and what potential issues can arise from its usage?

The purpose of using mysql_fetch_array() in PHP is to fetch a result row as an associative array, a numeric array, or both from a MySQL database query. One potential issue that can arise from its usage is that it is deprecated as of PHP 5.5.0 and removed in PHP 7.0.0. It is recommended to use mysqli_fetch_array() or PDO fetch methods instead to ensure compatibility and security.

// Connect to the database
$conn = mysqli_connect($servername, $username, $password, $dbname);

// Perform a query
$result = mysqli_query($conn, "SELECT * FROM table");

// Fetch rows using mysqli_fetch_array()
while ($row = mysqli_fetch_array($result)) {
    // Process the row data
}

// Close the connection
mysqli_close($conn);