mysql_

Issue: The "mysql_" functions are deprecated in PHP and should not be used in modern applications. Instead, you should use MySQLi or PDO for database interactions to ensure better security and compatibility with newer 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);
}

// Perform a query using prepared statement
$stmt = $mysqli->prepare("SELECT * FROM table WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();

// Fetch data
while ($row = $result->fetch_assoc()) {
    // Do something with the data
}

// Close connection
$mysqli->close();