php - Mysql_error is not working properly -
i using below code checking errors in query, working properly, showing duplicate key of primary unique after storing showing error message:
array ( [0] => duplicate entry '20130222-81' key 'primary' ) data insertion successful here code:
$errors = array(); if (!$connection->query($query)) { $errors[] = $connection->error; } if(count($errors) === 0) { $connection->commit(); } else { $connection->rollback(); print_r($errors); }
Comments
Post a Comment