How MySQL confirms that the Update,delete,insert statement executed successfully

Source: Internet
Author: User
How does MySQL confirm that the Update,delete,insert statement was executed successfully?
Title, now through Mysql_affected_rows () in judgment, so that the words will cause almost every sentence update,delete,insert behind must follow a sentence
if (Mysql_affected_rows ()!=1)
{
Error
}

Is there any more convenient way?
------to solve the idea----------------------
If you don't trust update ... set money=money-1 will actually execute
Do you need to select again to confirm that money is reduced by 1 instead of 100?

$result = mysql_query ("Update ...")
False is returned only if the SQL instruction is an error
So there's no need to try
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.