What are the potential pitfalls of using deprecated mysql functions in PHP?

Using deprecated mysql functions in PHP can lead to security vulnerabilities and compatibility issues with newer versions of PHP. It is recommended to switch to mysqli or PDO for database operations as they offer better security features and are supported in the latest PHP versions.

// Example of using mysqli instead of deprecated mysql functions
$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 data
}

$mysqli->close();