Thinkphp-addall Method-How does the AddAll () method inside the thinkphp determine if the update was successful? The method returns as if it were the first inserted ID.

Source: Internet
Author: User
Keywords Thinkphp thinkphp-addall method PHP
Tags addall
The AddAll () method is used in the project, and transaction processing is turned on.
If the AddAll () method is not fully inserted successfully, it is rolled back.
How to Judge AddAll () all inserted successfully.
Maybe there are other better options?

Reply content:

The AddAll () method is used in the project, and transaction processing is turned on.
If the AddAll () method is not fully inserted successfully, it is rolled back.
How to Judge AddAll () all inserted successfully.
Maybe there are other better options?

AddAll is written to the database one time or all succeeds or all fails. SQL performs insert into tbl_name (a,b,c) VALUES (All-in-one), (4,5,6), (7,8,9);

I remember AddAll. If you set the primary key of the data table and so on, if it exists then the update does not exist insert:

M()->addAll($data , true )
  • Related Article

    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.