Integrity constraint violation: 1062 Duplicate entry '127' for key 'PRIMARY' in

Viewed 24

Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '127' for key 'PRIMARY' in /Applications/XAMPP/xamppfiles/htdocs/ashraf/index.php:24 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/ashraf/index.php(24): PDOStatement->execute() #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/ashraf/index.php on line 24[enter

for ($i = 1; $i <= 500; $i++){

    $stmt = $db->prepare("INSERT INTO `items` (`id`) VALUES ('127');");
    
    $stmt->execute();

}
0 Answers
Related