What are the potential pitfalls of using mysql_-functions in PHP7 and what alternatives should be considered?

Using mysql_-functions in PHP7 is not recommended as they have been deprecated since PHP 5.5 and removed in PHP 7. Instead, developers should use mysqli or PDO for database operations. These alternatives provide better security features, support for prepared statements, and overall better performance.

// Using mysqli for database operations
$mysqli = new mysqli("localhost", "username", "password", "database");

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

// Perform database operations using mysqli

$mysqli->close();