What are the potential risks of using the mysql_* extension in PHP?

Using the mysql_* extension in PHP is deprecated and poses security risks due to its lack of prepared statements and vulnerability to SQL injection attacks. It is recommended to switch to MySQLi or PDO extensions for database interactions to ensure better security and future compatibility.

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

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