What are the drawbacks of creating a new table for each data entry in a while loop?

Creating a new table for each data entry in a while loop can lead to a large number of tables being created unnecessarily, which can impact the performance and efficiency of the database. Instead, it is better to insert the data into a single table and use a unique identifier or primary key to distinguish between different entries.

// Connect to the 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);
}

// Insert data into a single table
while ($row = $result->fetch_assoc()) {
    $data = $row['data'];
    
    $sql = "INSERT INTO your_table_name (data) VALUES ('$data')";
    
    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}

// Close the connection
$conn->close();