MySQL Improved Extension (
Mysqli
)
2308
What is an Extension?
In the PHP documentation you will come across another term - extension. The PHP code consists of a
core, with optional extensions to the core functionality. PHP's MySQL-related extensions, such as the
mysqli
extension, and the
mysql
extension, are implemented using the PHP extension framework.
An extension typically exposes an API to the PHP programmer, to allow its facilities to be used
programmatically. However, some extensions which use the PHP extension framework do not expose
an API to the PHP programmer.
The PDO MySQL driver extension, for example, does not expose an API to the PHP programmer, but
provides an interface to the PDO layer above it.
The terms API and extension should not be taken to mean the same thing, as an extension may not
necessarily expose an API to the programmer.
What are the main PHP API offerings for using MySQL?
There are three main API options when considering connecting to a MySQL database server:
• PHP's MySQL Extension
• PHP's mysqli Extension
• PHP Data Objects (PDO)
Each has its own advantages and disadvantages. The following discussion aims to give a brief
introduction to the key aspects of each API.
What is PHP's MySQL Extension?
This is the original extension designed to allow you to develop PHP applications that interact with a
MySQL database. The
mysql
extension provides a procedural interface and is intended for use only
with MySQL versions older than 4.1.3. This extension can be used with versions of MySQL 4.1.3 or
newer, but not all of the latest MySQL server features will be available.
Note
If you are using MySQL versions 4.1.3 or later it is strongly recommended that
you use the
mysqli
extension instead.
The
mysql
extension source code is located in the PHP extension directory
ext/mysql
.
For further information on the
mysql
extension, see
Section 20.7.2, “Original MySQL API (
Mysql
)”
.
What is PHP's mysqli Extension?
The
mysqli
extension, or as it is sometimes known, the MySQL improved extension, was developed
to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The
mysqli
extension is included with PHP versions 5 and later.
The
mysqli
extension has a number of benefits, the key enhancements over the
mysql
extension
being:
• Object-oriented interface
• Support for Prepared Statements
• Support for Multiple Statements
• Support for Transactions
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...