ThingEngineer / PHP-MySQLi-Database-Class

Wrapper for a PHP MySQL class, which utilizes MySQLi and prepared statements.
Other
3.28k stars 1.35k forks source link

Uncaught mysqli_sql_exception: Duplicate entry #1032

Open TwinMist opened 1 month ago

TwinMist commented 1 month ago

Just migrated to php 8.3 was using 7.2 before with no issues. i have multiple inserts within the same script which somehow is causing duplicated inserts from another part of the script on this error the table does not even have primary key date this was a insert from another part of the script any ideas?

thrown in /scripts/vendor/thingengineer/mysqli-database-class/MysqliDb.php on line 1545 [Wed Jun 5 17:26:05 2024] 127.0.0.1:41774 [500]: PUT /indexLive.php - Uncaught mysqli_sql_exception: Duplicate entry '2024-06-05 17:26:05-6654910' for key 'Date' in /scripts/vendor/thingengineer/mysqli-database-class/MysqliDb.php:1545 Stack trace:

0 /scripts/vendor/thingengineer/mysqli-database-class/MysqliDb.php(1545): mysqli_stmt->execute()

1 /scripts/vendor/thingengineer/mysqli-database-class/MysqliDb.php(837): MysqliDb->_buildInsert()

2 /scripts/vendor/thingengineer/mysqli-database-class/MysqliDb.php(866): MysqliDb->insert()

3 /scripts/configs/Live/LogLicenses.php(21): MysqliDb->insertMulti()

4 /scripts/indexLive.php(439): require_once('...')

5 {main}

RivenSkaye commented 2 weeks ago

Could it perhaps be a UNIQUE constraint (possibly combined with a default value of NOW()) on one of the columns which you're bulk-updating?