What are the potential pitfalls of using outdated PHP functions like mysql_*?

Using outdated PHP functions like mysql_* can pose security risks as they are no longer actively maintained and may contain vulnerabilities. It is recommended to switch to newer functions like mysqli or PDO for database operations to ensure better security and compatibility with the latest PHP versions.

// Connect to MySQL using mysqli
$mysqli = new mysqli('localhost', 'username', 'password', 'database');

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