我使用以下代码检查查询中的错误,一切正常,但显示主要重复密钥,即使在存储后显示此错误消息也是唯一的:
Array
(
[0] => Duplicate entry '20130222-81' for key 'PRIMARY'
)
Data Insertion was Successful
这是我的代码:
$errors = array();
if (!$connection->query($query))
{
$errors[] = $connection->error;
}
if(count($errors) === 0)
{
$connection->commit();
}
else
{
$connection->rollback();
print_r($errors);
}