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

Using outdated PHP functions like mysql_* instead of mysqli_* can lead to security vulnerabilities, as the mysql_* functions are deprecated and no longer supported in newer PHP versions. To avoid these pitfalls, it is recommended to switch to mysqli_* functions, which offer improved security features and better support for modern databases.

// Connect to MySQL using mysqli_* functions
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

$conn = mysqli_connect($servername, $username, $password, $dbname);

if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}