The mysqli extension allows you to access the functionality provided by MySQL 4.1 and above. More information about the MySQL Database server can be found at http://www.mysql.com/
Documentation for MySQL can be found at http://www.mysql.com/documentation/.
| 警告 |
這個延伸是實驗性質的。這個延伸的行為 -- 包括函數名稱和包含此延伸的任何其它文件 -- 在未來PHP的發行中可能會在不通知的情況改變。使用此延伸需自行承擔風險。 |
In order to have these functions available, you must compile PHP with support for the mysqli extension.
注: The mysqli extension is designed to work with the version 4.1 or above of MySQL. For previous versions, please see the MySQL extension documentation.
To install the mysqli extension for PHP, use the --with-mysqli=mysql_config_path configuration option where mysql_config_path represents the location of the mysql_config program that comes with MySQL versions greater than 4.1. Also, disable the standard MySQL extension (which is enabled by default) by also using the --without-mysql configuration option. If you would like to install the standard mysql extension along with the mysqli extension, the bundled libmysql library that comes with PHP cannot be used. Instead, use the client libraries installed by MySQL with versions below 4.1. This will force PHP to use the client libraries installed by MySQL thus avoiding any conflicts.
php.ini中的設定會影響這些函數的行為。
表格 1. MySQLi Configuration Options
| Name | Default | Changeable |
|---|---|---|
| mysqli.max_links | "-1" | PHP_INI_SYSTEM |
| mysqli.default_port | NULL | PHP_INI_ALL |
| mysqli.default_socket | NULL | PHP_INI_ALL |
| mysqli.default_host | NULL | PHP_INI_ALL |
| mysqli.default_user | NULL | PHP_INI_ALL |
| mysqli.default_pw | NULL | PHP_INI_ALL |
For further details and definitions of the above PHP_INI_* constants, see the chapter on configuration changes.
這裡為簡短的結構指令說明。
The maximum number of MySQL connections per process, including persistent connections.
The default TCP port number to use when connecting to the database server if no other port is specified. If no default is specified, the port will be obtained from the MYSQL_TCP_PORT environment variable, the mysql-tcp entry in /etc/services or the compile-time MYSQL_PORT constant, in that order. Win32 will only use the MYSQL_PORT constant.
The default socket name to use when connecting to a local database server if no other socket name is specified.
The default server host to use when connecting to the database server if no other host is specified. Doesn't apply in safe mode.
The default user name to use when connecting to the database server if no other name is specified. Doesn't apply in safe mode.
The default password to use when connecting to the database server if no other password is specified. Doesn't apply in safe mode.
表格 2. MySQLi Constants
| Name | Description |
|---|---|
| MYSQLI_READ_DEFAULT_GROUP (integer) | |
| MYSQLI_READ_DEFAULT_FILE (integer) | |
| MYSQLI_OPT_CONNECT_TIMEOUT (integer) | |
| MYSQLI_OPT_LOCAL_INFILE (integer) | |
| MYSQLI_INIT_COMMAND (integer) | |
| MYSQLI_CLIENT_SSL (integer) | |
| MYSQLI_CLIENT_COMPRESS (integer) | |
| MYSQLI_CLIENT_INTERACTIVE (integer) | |
| MYSQLI_CLIENT_IGNORE_SPACE (integer) | |
| MYSQLI_CLIENT_NO_SCHEMA (integer) | |
| MYSQLI_CLIENT_MULTI_QUERIES (integer) | |
| MYSQLI_STORE_RESULT (integer) | |
| MYSQLI_USE_RESULT (integer) | |
| MYSQLI_ASSOC (integer) | |
| MYSQLI_NUM (integer) | |
| MYSQLI_BOTH (integer) | |
| MYSQLI_NOT_NULL_FLAG (integer) | |
| MYSQLI_PRI_KEY_FLAG (integer) | |
| MYSQLI_UNIQUE_KEY_FLAG (integer) | |
| MYSQLI_MULTIPLE_KEY_FLAG (integer) | |
| MYSQLI_BLOB_FLAG (integer) | |
| MYSQLI_UNSIGNED_FLAG (integer) | |
| MYSQLI_ZEROFILL_FLAG (integer) | |
| MYSQLI_AUTO_INCREMENT_FLAG (integer) | |
| MYSQLI_TIMESTAMP_FLAG (integer) | |
| MYSQLI_SET_FLAG (integer) | |
| MYSQLI_NUM_FLAG (integer) | |
| MYSQLI_PART_KEY_FLAG (integer) | |
| MYSQLI_GROUP_FLAG (integer) | |
| MYSQLI_TYPE_DECIMAL (integer) | |
| MYSQLI_TYPE_TINY (integer) | |
| MYSQLI_TYPE_SHORT (integer) | |
| MYSQLI_TYPE_LONG (integer) | |
| MYSQLI_TYPE_FLOAD (integer) | |
| MYSQLI_TYPE_DOUBLE (integer) | |
| MYSQLI_TYPE_NULL (integer) | |
| MYSQLI_TYPE_TIMESTAMP (integer) | |
| MYSQLI_TYPE_LONGLONG (integer) | |
| MYSQLI_TYPE_INT24 (integer) | |
| MYSQLI_TYPE_DATE (integer) | |
| MYSQLI_TYPE_TIME (integer) | |
| MYSQLI_TYPE_DATETIME (integer) | |
| MYSQLI_TYPE_YEAR (integer) | |
| MYSQLI_TYPE_NEWDATE (integer) | |
| MYSQLI_TYPE_ENUM (integer) | |
| MYSQLI_TYPE_SET (integer) | |
| MYSQLI_TYPE_TINY_BLOB (integer) | |
| MYSQLI_TYPE_MEDIUM_BLOB (integer) | |
| MYSQLI_TYPE_LONG_BLOB (integer) | |
| MYSQLI_TYPE_BLOB (integer) | |
| MYSQLI_TYPE_VAR_STRING (integer) | |
| MYSQLI_TYPE_STRING (integer) | |
| MYSQLI_TYPE_CHAR (integer) | |
| MYSQLI_TYPE_INTERVAL (integer) | |
| MYSQLI_TYPE_GEOMETRY (integer) | |
| MYSQLI_BIND_STRING (integer) | |
| MYSQLI_BIND_INT (integer) | |
| MYSQLI_BIND_DOUBLE (integer) | |
| MYSQLI_BIND_SEND_DATA (integer) | |
| MYSQLI_RPL_MASTER (integer) | |
| MYSQLI_RPL_SLAVE (integer) | |
| MYSQLI_RPL_ADMIN (integer) | |
| MYSQLI_NEED_DATA (integer) | |
| MYSQLI_NO_DATA (integer) | |
| MYSQLI_PR_REPORT_STDERR (integer) | |
| MYSQLI_PR_REPORT_PORT (integer) | |
| MYSQLI_PR_REPORT_FILE (integer) |