Php implements powerful MYSQL encapsulation class instances based on PDO, pdomysql
This example describes the MYSQL encapsulation class that php implements with powerful functions based on PDO. We will share this with you for your reference. The
This article mainly introduces PHP based on the PDO implementation of the powerful MySQL package class, combined with a complete example of PHP based on the implementation of the MySQL database connection, deletion, transaction and other methods,
Objective
In the actual development, PHP will be used with the database, because in the background need to have too much data to save, and the database is a good place to save data, we use PHP development database is a relational database MySQL,
The browser output is as follows.When you use Mysql_both or omit this argument, you will have both Mysql_num and mysql_ ASSOC attributes.MySQL the Mysql_fetch_array function obtains a row in the query result as an arraymysql_fetch_* column
For an object, you can access its member attributes in array mode and object mode; 100 points: class {
Public $ aaa = 1;
}
$ A = new ();
Echo $ a-> aaa; // 1
At the same time, you can directly:
Echo $ a ['AAA']; // 1
In PDO, we can implement $
PHP paging code in a variety of program development are required to use, in the development of the Web site is required to select one.
To write the paging code, you first need to understand the SQL query statement: SELECT * from goods limit 2, 7.
Pdo->begintransaction ()-Indicates the rollback start point
Pdo->commit ()-Indicates the rollback end point and executes the SQL
Pdo->__construct ()-Create an instance of the PDO link database
Pdo->errorcode ()-Get error code
PHP paging code in a variety of program development is necessary to use, in the development of the Web site is a necessary choice.
To write the paging code, first you have to understand the SQL query statement: SELECT * from goods limit 2, 7. PHP
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.