PHP 5 MySQLi Functions

Introduction to PHP MySQLi

PHP MySQLi = PHP MySQL Improved!

The MySQLi function allows you to access the MySQL database server.

Note: The MySQLi extension is designed for use with MySQL 4.1.13 or later.

Installation /Runtime Configuration

To be able to use MySQLi functions successfully, you must add support for MySQLi extensions when compiling PHP.

The MySQLi extension was introduced in PHP 5.0.0. MySQL Native Driver is included in PHP 5.3.0.

For more information on installation, visit: http://www.php.net/manual/en/mysqli.installation.php

For more information on running configuration, please visit: http://www.php.net/manual/en/mysqli.configuration.php

PHP 5 MySQLi Functions

function Description
mysqli_affected_rows () Returns the number of record rows affected by the previous MySQL operation.
mysqli_autocommit () Turn auto_commit database changes on or off.
mysqli_change_user () Change the user for the specified database connection.
mysqli_character_set_name () Returns the default character set of the database connection.
mysqli_close () Close the previously opened database connection.
mysqli_commit () Commit the current transaction.
mysqli_connect_errno () Returns the error code of the last connection error.
mysqli_connect_error () Returns the error description of the last connection error.
mysqli_connect () Open a new connection to the MySQL server.
mysqli_data_seek () Adjust the result pointer to an arbitrary row in the result set.
mysqli_debug () Perform debugging operations.
mysqli_dump_debug_info () Dump debugging information to the log.
mysqli_errno () Returns the last error code of the most recently called function.
mysqli_error_list () Returns the error list of the most recently called function.
mysqli_error () Returns the last error description of the most recently called function.
mysqli_fetch_all () Get all rows from the result set as an associative array, or an array of numbers, or both.
mysqli_fetch_array () Get a row from the result set as an associative array, or an array of numbers, or both.
mysqli_fetch_assoc () Get a row from the result set as an associative array.
mysqli_fetch_field_direct () Get the meta_data of a single field from the result set and return it as an object.
mysqli_fetch_field () Get the next field from the result set and return it as an object.
mysqli_fetch_fields () Returns an array of objects representing fields in the result.
mysqli_fetch_lengths() Returns the length of each column of the current row in the result set.
mysqli_fetch_object () Get the current row from the result set and return it as an object.
mysqli_fetch_row () Retrieves a row from the result set and returns it as an enumerated array.
mysqli_field_count () Returns the number of columns of the most recent query.
mysqli_field_seek () Set the pointer in the result set to the offset of the specified field.
mysqli_field_tell () Returns the position of the pointer in the result set.
mysqli_free_result () Free the result memory.
mysqli_get_charset () Returns a character set object.
mysqli_get_client_info () Returns the MySQL client library version.
mysqli_get_client_stats () Returns statistics about each process on the client.
mysqli_get_client_version () Returns the MySQL client library version as an integer.
mysqli_get_connection_stats () Returns statistics about client connections.
mysqli_get_host_info () Returns the MySQL server host name and connection type.
mysqli_get_proto_info () Returns the MySQL protocol version.
mysqli_get_server_info () Returns the MySQL server version.
mysqli_get_server_version () Returns the MySQL server version as an integer.
mysqli_info () Returns information about the most recently executed query.
mysqli_init () Initialize MySQLi and return the resources used by mysqli_real_connect ().
mysqli_insert_id () Returns the ID generated automatically in the last query.
mysql_kill () Request the server to kill a MySQL thread.
mysqli_more_results () Check if a multiple query has more results.
mysqli_multi_query() Execute one or more queries against the database.
mysqli_next_result () Prepare the next result set for mysqli_multi_query ().
mysqli_num_fields () Returns the number of fields in the result set.
mysqli_num_rows () Returns the number of rows in the result set.
mysqli_options () Set additional connection options to affect connection behavior.
mysqli_ping () Make a server connection and try to reconnect if the connection has been disconnected.
mysqli_prepare () Ready to execute a SQL statement.
mysqli_query () Execute a query against the database.
mysqli_real_connect () Open a new link to the MySQL server.
mysqli_real_escape_string () Escapes special characters in strings used in SQL statements.
mysqli_real_query () Execute SQL query
mysqli_reap_async_query () Returns the results of an asynchronous query.
mysqli_refresh () Refresh the table or cache, or reset the replication server information.
mysqli_rollback () Rolls back the current transaction in the database.
mysqli_select_db () Change the default database for the connection.
mysqli_set_charset () Set the default client character set.
mysqli_set_local_infile_default () Undo a user_defined handle for the load local infile command.
mysqli_set_local_infile_handler () Sets the rollback function for the LOAD DATA LOCAL INFILE command.
mysqli_sqlstate() Returns the SQLSTATE error code for the last MySQL operation.
mysqli_ssl_set () Used to create SSL secure connections.
mysqli_stat () Returns the current system status.
mysqli_stmt_init () Initialize the declaration and return the object used by mysqli_stmt_prepare ().
mysqli_store_result () Transfers the result set of the last query.
mysqli_thread_id () Returns the thread ID of the current connection.
mysqli_thread_safe () Returns whether the client library is compiled as thread_safe.
mysqli_use_result () Initial retrieval of the result set from the last query executed with mysqli_real_query ().
mysqli_warning_count () Returns the number of warnings for the last query in the connection.