English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP MySQLi Functions

The PHP MySQLi function allows access to the MySQLi database server. PHP can be used with MySQLi 4.1.13or higher version.

installation

The mysqli extension is in PHP 5introduced in version .0.0, while the MySQLi native driver is already included in PHP 5.3in version .0.

Function list

Version-Indicates the earliest PHP version that supports this function.

NumberFunction nameFunction descriptionVersion
1mysqli_affected_rows()It returns the number of rows affected by the last SELECT, INSERT, UPDATE, REPLACE, or DELETE query.4
2mysqli_autocommit()Open or close automatic submission of database modifications.4.3.0
3mysqli_begin_transaction()It is used to start a MySQL transaction.4.3.0
4mysqli_change_user()It is used to change the current/The user for the given database connection.4.3.0
5mysqli_character_set_name()It is used to retrieve the default character set of the current database.4.3.0
6mysqli_close()Used to close the MySQLi connection.4
7mysqli_commit()It is used to save database modifications.5
8mysqli_connect()Open a connection to the MySQLi server.4
9mysqli_connect_errno()It returns the error code from the last connection.5
10mysqli_connect_error()It returns the description of the error from the last connection.5
11mysqli_debug()Used for debugging operations.5
12mysqli_dump_debug_info()Used to dump debug information to the log.5
13mysqli_errno()It returns the last error code of the latest statement.4
14mysqli_error()It returns the last error description of the latest statement.4
15mysqli_error_list()It returns the error list from the last statement.4
16mysqli_field_count()It returns the number of columns of the most recent query./Field count.5
17mysqli_get_charset()It returns a charset object.4
18mysqli_get_client_info()It returns the MySQL client library version.5
19mysqli_get_client_stats()It returns statistical information about each process of the client.5
20mysqli_get_client_version()It returns the MySQLi client library version.5.1.0
21mysqli_get_connection_stats()It returns statistical information about the client connection.5
22mysqli_get_host_info()It returns the hostname and connection type of the MySQLi server.5
23mysqli_get_proto_info()It returns MySQLi protocol version information5
24mysqli_get_server_info()It returns MySQLi server information.5
25mysqli_get_server_version()It returns the MySQLi server version.5
26mysqli_get_warnings()It returns the error generated by the last query executed.5
27mysqli_info()It returns information about the query recently executed.5
28mysqli_init()It returns an object used with mysqli_real_connect().5
29mysqli_insert_id()It returns the ID of the last query.5
30mysqli_kill()This function requests the server to kill the process-The MySQLi thread specified by the id parameter.5
31mysqli_more_results()This function checks if there are more results from the multiple queries.5
32mysqli_multi_query()It used to separate the query from the database with a semicolon.5
33mysqli_next_result()It prepares the next result set for mysqli_multi_query().5
34mysqli_options()It is used to set connection options and change connection settings.5
35mysqli_ping()It is used to ping the server connection and reconnect to the server if the connection is disconnected.5
36mysqli_prepare()It performs a MySQL prepared query (with parameter markers) on the database.5
37mysqli_query()It performs a query on the database.5
38mysqli_real_connect()This function opens a new connection to the MySQL server.5
39mysqli_real_escape_string()This function escapes special characters in the SQL statement string.5
40mysqli_real_query()This function executes an SQL query.5
41mysqli_refresh()This function refreshes the table or cache, or resets the replication server information.5
42mysqli_rollback()This function rolls back the current transaction of the specified database connection.5
43mysqli_select_db()This function changes the default database.5
44mysqli_set_charset()This function sets the default character set.5
45mysqli_sqlstate()This function returns the last SQLSTATE error code of the last error.5
46mysqli_ssl_set()This function creates an SSL connection.5
47mysqli_stat()This function returns the current system status.5
48mysqli_stmt_init()This function initializes a statement and returns an object suitable for mysqli_stmt_prepare().5
49mysqli_thread__id()This function returns the current connection thread ID.5
50mysqli_thread_safe()This function is used to verify whether the client library is compiled as thread-safe (thread-safe).5
51mysqli_use_result()It initializes the retrieval of the result set from the query executed by the last mysqli_real_query().5
52mysqli_warning_count()It returns the number of errors generated by the last query executed.5
53mysqli_data_seek()It is used to move the internal result pointer.4
54mysqli_fetch_all()It is used to get all result rows and return the result set as an associative array4
55mysqli_fetch_array()It is used to get the result row as an associative array5
56mysqli_fetch_assoc()It is used to get the result row as an associative array.5.3
57mysqli_fetch_field()It is used to return the next column in the result set as an object.
4
58mysqli_fetch_field_direct()It returns the specified column in the form of an object./Definition information of field (as an integer parameter).
4
59mysqli_fetch_fields()It is used to return an array of objects.4
60mysqli_fetch_lengths()It is used to return the length of the field in the result.4
61mysqli_fetch_object()It returns an object.5
62mysqli_fetch_row()It returns the content of the current row of the result in the form of a string array.5
63mysqli_field_seek()This function sets the column cursor to the given column offset.5
64mysqli_field_tell()It returns the position of the cursor for the returned field.5
65mysqli_free_result()It releases the memory associated with the result.5
66mysqli_num_fields()It returns the number of fields in the result set.5
67mysqli_num_rows()It returns the number of rows in the result set.5
68mysqli_stmt_sqlstate()It returns SQLSTATE error from the last statement.5
69mysqli_stmt_affected_rows()It returns the number of rows affected (changed, deleted, inserted) by the last executed statement.5
70mysqli_stmt_attr_get()It returns the current value of the given attribute of the statement.5
71mysqli_stmt_attr_set()This function can be used to set various attributes for the statement to change its behavior.5
72mysqli_stmt_bind_param()It binds variables to the parameter placeholders in the prepared statement.5
73mysqli_stmt_bind_result()It binds the columns of the result object to variables.5
74mysqli_stmt_close()It closes a statement object.5
75mysqli_stmt_data_seek()It is used to search for rows in the result object.5
76mysqli_stmt_errno()It returns the error code that occurred during the execution of the last statement.5
77mysqli_stmt_error()It returns the description of the error that occurred during the execution of the last statement.5
78mysqli_stmt_execute()It executes a statement.5
79mysqli_stmt_fetch()It extracts the columns of the result into the specified variables.5
80mysqli_stmt_field_count()It returns the number of fields in the given statement result.5
81mysqli_stmt_free_result()It is used to free the memory stored for the statement results.5
82mysqli_stmt_get_result()It returns the results of the statement.5
83mysqli_stmt_num_rows()It returns the number of rows in the statement results.5
84mysqli_stmt_param_count()It returns the number of parameter placeholders in the prepared statement.5
85mysqli_stmt_prepare()It prepares to execute a SQL statement, where you can use parameter placeholders ("?") in the query.5
86mysqli_stmt_reset()It resets the error, unbuffered result set, and sent data through a statement.5
87mysqli_stmt_result_metadata()It returns a metadata object that stores information about the statement results.5
88mysqli_stmt_send_long_data()This function is used to send data in chunks to a column of type BLOB TEXT in the table if any column is of this type.5
89mysqli_stmt_store_result()It is used to store the result of statement objects locally.5