How to Verify the Success of a MySQL DELETE Operation
When executing a DELETE query using MySQL, it's crucial to determine whether the operation was successful. This is particularly important when deleting specific records based on criteria.
mysql_query() Method:
For traditional MySQL interactions using mysql_query(), a successful DELETE operation returns a boolean value:
PDO::exec() Method:
With PHP Data Objects (PDO), PDO::exec() is used for DELETE statements. Unlike mysql_query(), PDO::exec() returns the number of affected rows:
Additional Tips:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3