Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

MYSQLI_READ_DEFAULT_GROUP (int)

Read options from the named group from my.cnf or the file specified with MYSQLI_READ_DEFAULT_FILE.

MYSQLI_READ_DEFAULT_FILE (int)

Read options from the named option file instead of from my.cnf.

MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS (int)
Indicates to the server that the client can handle sandbox mode for expired passwords. Can be used with mysqli_options.
MYSQLI_OPT_LOAD_DATA_LOCAL_DIR (int)
If enabled, this option specifies the directory from which client-side LOCAL data loading is permitted in LOAD DATA LOCAL statements.
MYSQLI_OPT_CONNECT_TIMEOUT (int)

Connect timeout in seconds.

MYSQLI_OPT_READ_TIMEOUT (int)

Command execution result timeout in seconds. Available as of PHP 7.2.0.

MYSQLI_OPT_LOCAL_INFILE (int)

Enables command LOAD LOCAL INFILE.

MYSQLI_OPT_INT_AND_FLOAT_NATIVE (int)

Convert integer and float columns back to PHP numbers. Only valid for mysqlnd.

MYSQLI_OPT_NET_CMD_BUFFER_SIZE (int)

The size of the internal command/network buffer. Only valid for mysqlnd.

MYSQLI_OPT_NET_READ_BUFFER_SIZE (int)

Maximum read chunk size in bytes when reading the body of a MySQL command packet. Only valid for mysqlnd.

MYSQLI_OPT_SSL_VERIFY_SERVER_CERT (int)

MYSQLI_INIT_COMMAND (int)

Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.

MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (int)
Indicates to the server that the client can handle sandbox mode for expired passwords. Can be used with mysqli_real_connect.
MYSQLI_CLIENT_FOUND_ROWS (int)
Return number of matched rows, not the number of affected rows.
MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT (int)
Verify server certificate.
MYSQLI_CLIENT_SSL (int)

Use SSL (encrypted protocol). This option should not be set by application programs; it is set internally in the MySQL client library.

MYSQLI_CLIENT_COMPRESS (int)

Use compression protocol.

MYSQLI_CLIENT_INTERACTIVE (int)

Allow interactive_timeout seconds (instead of wait_timeout seconds) of inactivity before closing the connection. The client's session wait_timeout variable will be set to the value of the session interactive_timeout variable.

MYSQLI_CLIENT_IGNORE_SPACE (int)

Allow spaces after function names. Makes all functions names reserved words.

MYSQLI_CLIENT_NO_SCHEMA (int)

Don't allow the db_name.tbl_name.col_name syntax.

MYSQLI_CLIENT_MULTI_QUERIES

Allows multiple semicolon-delimited queries in a single mysqli_query call.

MYSQLI_STORE_RESULT (int)

For using buffered result sets. It has a value of 0.

MYSQLI_STORE_RESULT_COPY_DATA (int)
As of PHP 8.1, this constant no longer has any effect. Before PHP 8.1, this constant is used to copy results from the internal mysqlnd buffer into the PHP variables fetched. By default, mysqlnd will use a reference logic to avoid copying and duplicating results held in memory. For certain result sets, for example, result sets with many small rows, the copy approach can reduce the overall memory usage because PHP variables holding results may be released earlier. Available with mysqlnd only. Deprecated as of PHP 8.4.0.
MYSQLI_USE_RESULT (int)

For using unbuffered result sets. It has a value of 1.

MYSQLI_ASSOC (int)

Columns are returned into the array having the fieldname as the array index.

MYSQLI_NUM (int)

Columns are returned into the array having an enumerated index.

MYSQLI_BOTH (int)

Columns are returned into the array having both a numerical index and the fieldname as the associative index.

MYSQLI_NOT_NULL_FLAG (int)

Indicates that a field is defined as NOT NULL.

MYSQLI_PRI_KEY_FLAG (int)

Field is part of a primary index.

MYSQLI_UNIQUE_KEY_FLAG (int)

Field is part of a unique index.

MYSQLI_MULTIPLE_KEY_FLAG (int)

Field is part of an index.

MYSQLI_BLOB_FLAG (int)

Field is defined as BLOB.

MYSQLI_UNSIGNED_FLAG (int)

Field is defined as UNSIGNED.

MYSQLI_ZEROFILL_FLAG (int)

Field is defined as ZEROFILL.

MYSQLI_AUTO_INCREMENT_FLAG (int)

Field is defined as AUTO_INCREMENT.

MYSQLI_TIMESTAMP_FLAG (int)

Field is defined as TIMESTAMP.

MYSQLI_SET_FLAG (int)

Field is defined as SET.

MYSQLI_NUM_FLAG (int)

Field is defined as NUMERIC.

MYSQLI_PART_KEY_FLAG (int)

Field is part of an multi-index.

MYSQLI_GROUP_FLAG (int)

Field is part of GROUP BY.

MYSQLI_NO_DEFAULT_VALUE_FLAG (int)
A column has no DEFAULT clause in its definition. This does not apply to NULL or to AUTO_INCREMENT columns because such columns have a default value of NULL and an implied default value respectively.
MYSQLI_TYPE_DECIMAL (int)

Field is defined as DECIMAL.

MYSQLI_TYPE_NEWDECIMAL (int)

Precision math DECIMAL or NUMERIC field.

MYSQLI_TYPE_BIT (int)

Field is defined as BIT.

MYSQLI_TYPE_TINY (int)

Field is defined as TINYINT.

MYSQLI_TYPE_SHORT (int)

Field is defined as SMALLINT.

MYSQLI_TYPE_LONG (int)

Field is defined as INT.

MYSQLI_TYPE_FLOAT (int)

Field is defined as FLOAT.

MYSQLI_TYPE_DOUBLE (int)

Field is defined as DOUBLE.

MYSQLI_TYPE_NULL (int)

Field is defined as DEFAULT NULL.

MYSQLI_TYPE_TIMESTAMP (int)

Field is defined as TIMESTAMP.

MYSQLI_TYPE_LONGLONG (int)

Field is defined as BIGINT.

MYSQLI_TYPE_INT24 (int)

Field is defined as MEDIUMINT.

MYSQLI_TYPE_DATE (int)

Field is defined as DATE.

MYSQLI_TYPE_TIME (int)

Field is defined as TIME.

MYSQLI_TYPE_DATETIME (int)

Field is defined as DATETIME.

MYSQLI_TYPE_YEAR (int)

Field is defined as YEAR.

MYSQLI_TYPE_NEWDATE (int)

Field is defined as DATE.

MYSQLI_TYPE_INTERVAL (int)

Alias of MYSQLI_TYPE_ENUM. Removed as of PHP 8.4.0.

MYSQLI_TYPE_ENUM (int)

Field is defined as ENUM.

MYSQLI_TYPE_SET (int)

Field is defined as SET.

MYSQLI_TYPE_TINY_BLOB (int)

Field is defined as TINYBLOB.

MYSQLI_TYPE_MEDIUM_BLOB (int)

Field is defined as MEDIUMBLOB.

MYSQLI_TYPE_LONG_BLOB (int)

Field is defined as LONGBLOB.

MYSQLI_TYPE_BLOB (int)

Field is defined as BLOB.

MYSQLI_TYPE_VAR_STRING (int)

Field is defined as VARCHAR.

MYSQLI_TYPE_STRING (int)

Field is defined as CHAR or BINARY.

MYSQLI_TYPE_CHAR (int)

Field is defined as TINYINT. For CHAR, see MYSQLI_TYPE_STRING.

MYSQLI_TYPE_GEOMETRY (int)

Field is defined as GEOMETRY.

MYSQLI_TYPE_JSON (int)

Field is defined as JSON. Only valid for mysqlnd and MySQL 5.7.8 and up.

MYSQLI_NEED_DATA

More data available for bind variable.

MYSQLI_ENUM_FLAG (int)

Field is defined as ENUM.

MYSQLI_BINARY_FLAG (int)

Field is defined as BINARY.

MYSQLI_CURSOR_TYPE_FOR_UPDATE (int)

Removed as of PHP 8.4.0.

MYSQLI_CURSOR_TYPE_NO_CURSOR (int)

MYSQLI_CURSOR_TYPE_READ_ONLY (int)

MYSQLI_CURSOR_TYPE_SCROLLABLE (int)

Removed as of PHP 8.4.0.

MYSQLI_STMT_ATTR_CURSOR_TYPE (int)

MYSQLI_STMT_ATTR_PREFETCH_ROWS (int)

Removed as of PHP 8.4.0.

MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH (int)

MYSQLI_SET_CHARSET_NAME (int)

MYSQLI_REPORT_INDEX (int)

Report if no index or bad index was used in a query.

MYSQLI_REPORT_ERROR (int)

Report errors from mysqli function calls.

MYSQLI_REPORT_STRICT (int)

Throw a mysqli_sql_exception for errors instead of warnings.

MYSQLI_REPORT_ALL (int)

Set all options on (report all).

MYSQLI_REPORT_OFF (int)

Turns reporting off.

MYSQLI_DEBUG_TRACE_ENABLED (int)

Is set to 1 if mysqli_debug functionality is enabled.

MYSQLI_SERVER_PUBLIC_KEY (int)

MYSQLI_REFRESH_GRANT (int)

Refreshes the grant tables. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_LOG (int)

Flushes the logs, like executing the FLUSH LOGS SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_TABLES (int)

Flushes the table cache, like executing the FLUSH TABLES SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_HOSTS (int)

Flushes the host cache, like executing the FLUSH HOSTS SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_REPLICA (int)

Alias of MYSQLI_REFRESH_SLAVE constant. Available as of PHP 8.1.0. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_STATUS (int)

Reset the status variables, like executing the FLUSH STATUS SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_THREADS (int)

Flushes the thread cache. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_SLAVE (int)

On a slave replication server: resets the master server information, and restarts the slave. Like executing the RESET SLAVE SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_MASTER (int)

On a master replication server: removes the binary log files listed in the binary log index, and truncates the index file. Like executing the RESET MASTER SQL statement. Deprecated as of PHP 8.4.0.

MYSQLI_REFRESH_BACKUP_LOG (int)
Closes and reopens the backup log files. Deprecated as of PHP 8.4.0.
MYSQLI_TRANS_COR_AND_CHAIN (int)

Appends "AND CHAIN" to mysqli_commit or mysqli_rollback.

MYSQLI_TRANS_COR_AND_NO_CHAIN (int)

Appends "AND NO CHAIN" to mysqli_commit or mysqli_rollback.

MYSQLI_TRANS_COR_RELEASE (int)

Appends "RELEASE" to mysqli_commit or mysqli_rollback.

MYSQLI_TRANS_COR_NO_RELEASE (int)

Appends "NO RELEASE" to mysqli_commit or mysqli_rollback.

MYSQLI_TRANS_START_READ_ONLY (int)

Start the transaction as "START TRANSACTION READ ONLY" with mysqli_begin_transaction.

MYSQLI_TRANS_START_READ_WRITE (int)

Start the transaction as "START TRANSACTION READ WRITE" with mysqli_begin_transaction.

MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT

Start the transaction as "START TRANSACTION WITH CONSISTENT SNAPSHOT".

MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT (int)

Requires MySQL 5.6.5 and up.

MYSQLI_IS_MARIADB (bool)

Whether the mysqli extension has been built against a MariaDB client library. Available as of PHP 8.1.2.

MYSQLI_ASYNC (int)
The query is performed asynchronously and no result set is immediately returned. Available with mysqlnd only.
MYSQLI_ON_UPDATE_NOW_FLAG (int)
If a field is updated it will get the current time value.