PHP,PDO) Common functions

Source: Internet
Author: User

(1)

(2)

For example: If there is a problem with my SQL statement, I output the information generated by the two functions.

        

There is also a set of functions:

     

Are, open the transaction, roll back the transaction, commit the transaction, and determine whether it is in the transaction.

1 errorinfo () 2     An array of error messages that contain error messages.  3errorCode ()4     error code 5         failure during SQL execution causes an error:  67     

  

  

1 BeginTransaction (); 2 Open Transaction 3 rollback (); 4 rolling back a transaction 5 commit (); 6 Commit a transaction 7 intransaction (); 8 determine if you are in a transaction 9 Ten Lastinsertid ()  The value of the Auto_increment field that was finally formed.

1 another way to execute SQL.  2 differs from query () and the return value type is different. The Exec () return value type is integer. (Query () returns the object type).  3 The returned integer that represents the number of records that are affected by the current execution of SQL.  4 visible:5     query (), Execute Inquiry class, show,select, desc6     Exec (),    non-query class, INSERT,DELETE,UPDATE,DDL

  

Note that the number of records affected may be 0. But it doesn't mean execution failed!

  

Php,pdo) Common functions

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.