What potential issue arises when using INSERT INTO instead of UPDATE for modifying existing data in PHP?

When using INSERT INTO instead of UPDATE for modifying existing data in PHP, the potential issue that arises is duplicate entries being created in the database instead of updating the existing data. To solve this issue, you should use UPDATE statement to modify existing data in the database based on a specific condition (e.g., unique identifier).

<?php
// Connect to database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = new mysqli($servername, $username, $password, $dbname);

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

// Update existing data in the database
$sql = "UPDATE table_name SET column1 = 'new_value' WHERE id = 1";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?>