What are the potential pitfalls of using mysql_fetch_* functions in PHP?

Using mysql_fetch_* functions in PHP is not recommended because they are deprecated as of PHP 5.5.0 and removed in PHP 7.0.0. It is advised to use the MySQLi or PDO extension for database operations to ensure compatibility and security.

// Using MySQLi extension to fetch data from a database
$mysqli = new mysqli("localhost", "username", "password", "database");

if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}

$result = $mysqli->query("SELECT * FROM table");

while ($row = $result->fetch_assoc()) {
    // Process the data
}

$mysqli->close();