tailieunhanh - Session 2The PHP Data Objects (PDO)
The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP Each database driver that implements the PDO interface can expose database-specific features as regular extension functions you must use a database-specific PDO driver to access a database server PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data | Session 2 The PHP Data Objects (PDO) Author: Ngo Trung Kien Date:Monday, July 05, 2010 PDO Object session Introduction the PDO Installation PDO PDO Drivers The PDO class The PDOStatement class Demo PDO Introduction the PDO The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP Each database driver that implements the PDO interface can expose database-specific features as regular extension functions you must use a database-specific PDO driver to access a database server PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features PDO Installation PDO Installing PDO on Unix systems: extension= Windows users extension= extension= extension= extension= . | Session 2 The PHP Data Objects (PDO) Author: Ngo Trung Kien Date:Monday, July 05, 2010 PDO Object session Introduction the PDO Installation PDO PDO Drivers The PDO class The PDOStatement class Demo PDO Introduction the PDO The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP Each database driver that implements the PDO interface can expose database-specific features as regular extension functions you must use a database-specific PDO driver to access a database server PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features PDO Installation PDO Installing PDO on Unix systems: extension= Windows users extension= extension= extension= extension= extension= extension= extension= extension= extension= extension= PDO PDO Drivers The following drivers currently implement the PDO interface PDO Driver PDO_MYSQL - PDO_MYSQL DSN[1] PDO_MYSQL DSN — Connecting to MySQL databases The PDO_MYSQL Data Source Name (DSN) is composed of the following elements: Ví dụ DSN: mysql:host=localhost;port=3307;dbname=testdb host The hostname on which the database server resides Port The port number where the database server is listening dbname The name of the database PDO PDO Connection to a database PDO::__construct — Creates a PDO instance representing a connection to a database. Syntax: PDO::__construct ( string $dsn [, string $username [, string $password [, array $driver_options ]]] ) PDO Example – PDO connect PDO The PDO class PDO::__construct — Creates a PDO instance representing a connection to a database PDO::query() - Executes
đang nạp các trang xem trước