• PHP Video Tutorials

PHP - MySQLi Functions



PHP MySQLi functions gives to access the MySQLi database servers. PHP works with MySQLi version 4.1.13 or newer.

Installation

MySQLi extension was introduced with PHP version 5.0.0 and MySQLi native Driver was included in PHP version 5.3.0.

Installation details are available at here

List of Functions

PHP − indicates the earliest version of PHP that supports the function.

Sr.No Function & Description PHP
1 mysqli_affected_rows

It returns the number of affected rows in the previous SELECT, INSERT, UPDATE, REPLACE, or DELETE query.

4
2 mysqli_autocommit

It is used to turn off or turn of auto-committing database modifications.

4.3.0
3 mysqli_begin_transaction

It is used to start a MySQL transaction.

4.3.0
4 mysqli_change_user

It is used to change the user of the current/given database connection.

4.3.0
5 mysqli_character_set_name

It is used to retrieve the default character set of the current database.

4.3.0
6 mysqli_close

It is used to close MySQLi connection

4
7 mysqli_commit

It is used to save the database modifications.

5
8 mysqli_connect

It opens a connection to a MySQLi Server

4
9 mysqli_connect_errno

It returns the error code from the last connection

5
10 mysqli_connect_error

It returns the description of the error from the last connection

5
11 mysqli_debug

It is used to performs debugging operations

5
12 mysqli_dump_debug_info

It is used dumps debugging info into the log

5
13 mysqli_errno

It returns the last error code for the most recent statement

4
14 mysqli_error

It returns the last error description for the most recent statement

4
15 mysqli_error_list

It returns a list of errors from the last statement

4
16 mysqli_field_count

It returns the number of columns/field for the most recent query.

5
17 mysqli_get_charset

It returns a character set object.

4
18 mysqli_get_client_info

It returns the MySQL client library version.

5
19 mysqli_get client_stats

It returns statistics about client per-process.

5
20 mysqli_get_client_version

It returns the MySQLi client library version.

5.1.0
21 mysqli_get_connection_stats

It returns statistics about the client connection.

5
22 mysqli_get_host_info

It returns the MySQLi server hostname and the connection type.

5
23 mysqli_get_proto_info

It returns the MySQLi protocol version information

5
24 mysqli_get_server_info

It returns the MySQLi server information.

5
25 mysqli_get_server_version

It returns the MySQLi server version.

5
26 mysqli_get_warnings

It returns the errors generated by the last executed query.

5
27 mysqli_info

It returns information about the most recently executed query.

5
28 mysqli_init

It returns an object to use with the mysqli_real_connect() function.

5
29 mysqli_insert_id

It returns an id of last query.

5
30 mysqli_kill

This function asks to the server to kill MySQLi thread specified by the process-id parameter.

5
31 mysqli_more_results

This function checks if there are more results from a multi query.

5
32 mysqli_multi_query

It used to separate the queries with a semicolon against the database.

5
33 mysqli_next_result

It prepares the next result set from mysqli_multi_query().

5
34 mysqli_options

It is used to sets connect options and change connection settings.

5
35 mysqli_ping

It is used to pings a server connection and reconnect to server if connection is lost.

5
36 mysqli_prepare

It performs a MySQL prepared query (with parameter markers) against the database.

5
37 mysqli_query

It performs a query against the database.

5
38 mysqli_real_connect

This function opens a new connection to the MySQLi

5
39 mysqli_real_escape_string

This function escapes special characters in a string for an SQL statement.

5
40 mysqli_real_query

This function executes an SQL query.

5
41 mysqli_refresh

This function refreshes tables or caches, or resets the replication server information.

5
42 mysqli_rollback

This function rolls back the current transaction for the specified database connection.

5
43 mysqli_select_db

This function changes the default database.

5
44 mysqli_set_charset

It function sets the default character set.

5
45 mysqli_sqlstate

This function returns the SQLSTATE error code for the last error.

5
46 mysqli_ssl_set

This function creates an SSL connection.

5
47 mysqli_stat

This function returns the current system status.

5
48 mysqli_stmt_init

This function initializes a statement and returns an object suitable for mysqli_stmt_prepare().

5
49 mysqli_thread _id

This function returns the current connection thread ID.

5
50 mysqli_thread_safe

This function verifies whether the client library is compiled as thread-safe.

5
51 mysqli_use_result

It starts the retrieval of the resultset from the previously executed query.

5
52 mysqli_warning_count

It returns the number of errors generated by the last executed query.

5
53 mysqli_data_seek

It is used to move internal result pointer.

4
54 mysqli_fetch all

It is used to fetchs all result rows and returns the result set as an associative array

4
55 mysqli_fetch array

It is used to fetchs a result row as an associative array

5
56 mysqli_fetch_assoc

It is used to fetches a result row as an associative array.

5.3
57 mysqli_fetch_field

It is used to returns the next column in the result set as an object.

4
58 mysqli_fetch_field_direct

It returns the definition information of the specified (as an integer argument) column/field in the form of an object.

4
59 mysqli_fetch_fields

It is used to returns an array of objects.

4
60 mysqli_fetch_lengths

It is used to returns the length of the fields in the result.

4
61 mysqli_fetch_object

It returns an object.

5
62 mysqli_fetch_row

It returns the contents of the current row of a result as an array of strings.

5
63 mysqli_field_seek

This function sets the column cursor to the given column offset.

5
64 mysqli_field_tell

It returns returns the position of the field cursor.

5
65 mysqli_free_result

It frees the memory associated with the result.

5
66 mysqli_num_fields

It returns the number of fields in a result set.

5
67 mysqli_num_rows

It returns the number of rows in a result set.

5
68 mysqli_stmt_sqlstate

It returns the SQLSTATE error from the last statement.

5
69 mysqli_stmt_affected_rows

It returns the number of rows affected (changed, deleted, inserted) by the recently executed statement.

5
70 mysqli_stmt_attr_get

It returns the current value of the given attribute of a statement.

5
71 mysqli_stmt_attr_set

Using this function can set various attributes to the statement which changes its behaviour.

5
72 mysqli_stmt_bind_param

It bind variables to the parameter markers of a prepared statement.

5
73 mysqli_stmt_bind_result

It binds the columns of a result object to variables.

5
74 mysqli_stmt_close

It closes a statement object.

5
75 mysqli_stmt_data_seek

It is used to seek through the rows of a result object.

5
76 mysqli_stmt_errno

It returns the code of the error occurred during the execution of the last statement.

5
77 mysqli_stmt_error

It returns the description of the error occurred during the execution of the last statement.

5
78 mysqli_stmt_execute

It executes a statement.

5
79 mysqli_stmt_fetch

It fetches the columns of the result into the specified variables.

5
80 mysqli_stmt_field_count

It returns the number of fields in the result of the given statement.

5
81 mysqli_stmt_free_result

It is used to free the memory in which the result of the a statement is stored.

5
82 mysqli_stmt_get_result

It returns the result of a statement.

5
83 mysqli_stmt_num_rows

It returns the number of rows in the result of a statement.

5
84 mysqli_stmt_param_count

It returns the number of parameter markers in a prepared statement.

5
85 mysqli_stmt_prepare

It prepares an SQL statement for execution, you can use parameter markers ("?") in this query instead of values.

5
86 mysqli_stmt_reset

It is used to resets the errors, unbuffered result sets and data sent, though a statement.

5
87 mysqli_stmt_result_metadata

It returns a metadata object which holds information about the result of a statement.

5
88 mysqli_stmt_send_long_data

If one of the columns of table is of TEXT of BLOB type,this function is used to send data to that column in chunks.

5
89 mysqli_stmt_store_result

It is used to store the result of a statement object locally.

5
php_function_reference.htm
Advertisements