PHP 5 MySQLi Functions

PHP MySQLi Introduction

PHP MySQLi = PHP MySQL Improved!

The MySQLi functions allow you to access the MySQL database server.

Note:The MySQLi extension is designed to be compatible with MySQL version 4.1.13 or later.

Installation / Runtime Configuration

To make MySQLi available, you must compile PHP to support the MySQLi extension.

The MySQLi extension was introduced in PHP version 5.0.0. The MySQL local driver included in PHP 5.3.0 version.

For installation details, please visit:http://www.php.net/manual/zh/mysqli.installation.php

For runtime configuration details, please visit:http://www.php.net/manual/zh/mysqli.configuration.php

PHP 5 MySQLi Functions

Function Description
mysqli_affected_rows() Return the number of rows affected by the previous Mysql operation.
mysqli_autocommit() Toggle the automatic submission of database modifications.
mysqli_change_user() Change the user for the specified database connection.
mysqli_character_set_name() Return the default character set of the database connection.
mysqli_close() Close the previously opened database connection.
mysqli_commit() Submit the current transaction.
mysqli_connect_errno() Returns the error code of the last connection call.
mysqli_connect_error() Returns the error description of the last connection error.
mysqli_connect() Establishes a new connection to the MySQL server.
mysqli_data_seek() Adjusts the result pointer to an arbitrary row in the result set.
mysqli_debug() Performs debugging operations.
mysqli_dump_debug_info() Dumps debug information to the log.
mysqli_errno() Returns the error code produced by the last function call.
mysqli_error_list() Returns a list of error messages produced by the last function call.
mysqli_error() Returns a string describing the error code produced by the last function call.
mysqli_fetch_all() Fetches all result rows and returns the result set as an associative array, a numeric index array, or both.
mysqli_fetch_array() Fetches a row of results as an associative array, a numeric index array, or both.
mysqli_fetch_assoc() Fetches a row of results as an associative array.
mysqli_fetch_field_direct() Returns metadata for a single field in the result set as an object.
mysqli_fetch_field() Returns the next field in the result set as an object.
mysqli_fetch_fields() Returns an array of objects representing the fields in the result set.
mysqli_fetch_lengths() Returns the length of the columns in the current row of the result set.
mysqli_fetch_object() Returns the current row of the result set as an object.
mysqli_fetch_row() Fetches a row from the result set and returns it as an enumerated array.
mysqli_field_count() Returns the number of columns obtained from the last query.
mysqli_field_seek() Sets the field pointer to the start of a specific field.
mysqli_field_tell() Returns the position of the field pointer.
mysqli_free_result() Frees the memory associated with a result set.
mysqli_get_charset() Returns a character set object.
mysqli_get_client_info() Returns a string representing the MySQL client version information.
mysqli_get_client_stats() Return the statistical information of each client process.
mysqli_get_client_version() Return the integer Mysql client version information.
mysqli_get_connection_stats() Return statistical information of the client connection.
mysqli_get_host_info() Return the MySQL server hostname and connection type.
mysqli_get_proto_info() Return the MySQL protocol version.
mysqli_get_server_info() Return the MySQL server version.
mysqli_get_server_version() Return the integer MySQL server version information.
mysqli_info() Return the retrieval information of the last executed query.
mysqli_init() Initialize mysqli and return the resource type used by mysqli_real_connect().
mysqli_insert_id() Return the automatically generated id used in the last query.
mysql_kill() Request the server to terminate a MySQL thread.
mysqli_more_results() Check if there are any more result sets in a multi-statement query.
mysqli_multi_query() Execute one or more queries on the database.
mysqli_next_result() Prepare the next result set from mysqli_multi_query().
mysqli_num_fields() Return the number of fields in the result set.
mysqli_num_rows() Return the number of rows in the result set.
mysqli_options() Set options.
mysqli_ping() Ping a server connection, or try to reconnect if that connection was lost.
mysqli_prepare() Prepare an SQL statement for execution.
mysqli_query() Execute query on the database.
mysqli_real_connect() Open a new connection to the Mysql server.
mysqli_real_escape_string() Escape special characters in the string used in SQL statements.
mysqli_real_query() Execute SQL query.
mysqli_reap_async_query() Return the result of the asynchronous query.
mysqli_refresh() Refresh the table or cache, or reset the replication server information.
mysqli_rollback() Roll back the current transaction.
mysqli_select_db() Change the default database of the connection.
mysqli_set_charset() Set the default client character set.
mysqli_set_local_infile_default() Clear the handler defined by the user for the load local infile command.
mysqli_set_local_infile_handler() Set the callback function executed by the LOAD DATA LOCAL INFILE command.
mysqli_sqlstate() Return the SQLSTATE error code of the previous Mysql operation.
mysqli_ssl_set() Establish an installed connection using SSL.
mysqli_stat() Return the current system status.
mysqli_stmt_init() Initialize a statement and return an object used by mysqli_stmt_prepare().
mysqli_store_result() Transfer the result set of the last query.
mysqli_thread_id() Return the thread ID of the current connection.
mysqli_thread_safe() Return whether thread safety is set.
mysqli_use_result() Initialize a result set fetch.
mysqli_warning_count() Return the number of warnings from the last query in the connection.