We now have a youtube channel. Subscribe!

PHP | MYSQLi Functions

PHP MYSQLi Functions


Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP MYSQLi Functions.

The MYSQLi functions gives full access to 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 the MYSQLi native driver was included in PHP version 5.3.0.

For the Installation details, kindly visit the official PHP site using this link


List of MYSQLi Functions

The following table is a list of the MYSQLi functions that are supported in PHP. PHP - indicates the earliest versions of PHP that have support for the functions.

Sr.NoFunction & DescriptionPHP
1mysqli_affected_rows

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

4
2mysqli_autocommit

It is used to turn off or turn on auto-committing 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 user of the current/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

It is used to close MySQLi connection

4
7mysqli_commit

It is used to save the database modifications.

5
8mysqli_connect

It opens a connection to a 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

It is used to performs debugging operations

5
12mysqli_dump_debug_info

It is used dumps debugging info into the log

5
13mysqli_errno

It returns the last error code for the most recent statement

4
14mysqli_error

It returns the last error description for the most recent statement

4
15mysqli_error_list

It returns a list of errors from the last statement

4
16mysqli_field_count

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

5
17mysqli_get_charset

It returns a character set object.

4
18mysqli_get_client_info

It returns the MySQL client library version.

5
19mysqli_get client_stats

It returns statistics about client per-process.

5
20mysqli_get_client_version

It returns the MySQLi client library version.

5.1.0
21mysqli_get_connection_stats

It returns statistics about the client connection.

5
22mysqli_get_host_info

It returns the MySQLi server hostname and the connection type.

5
23mysqli_get_proto_info

It returns the MySQLi protocol version information

5
24mysqli_get_server_info

It returns the MySQLi server information.

5
25mysqli_get_server_version

It returns the MySQLi server version.

5
26mysqli_get_warnings

It returns the errors generated by the last executed query.

5
27mysqli_info

It returns information about the most recently executed query.

5
28mysqli_init

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

5
29mysqli_insert_id

It returns an id of last query.

5
30mysqli_kill

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

5
31mysqli_more_results

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

5
32mysqli_multi_query

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

5
33mysqli_next_result

It prepares the next result set from mysqli_multi_query().

5
34mysqli_options

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

5
35mysqli_ping

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

5
36mysqli_prepare

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

5
37mysqli_query

It performs a query against the database.

5
38mysqli_real_connect

This function opens a new connection to the MySQLi

5
39mysqli_real_escape_string

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

5
40mysqli_real_query

This function executes an SQL query.

5
41mysqli_refresh

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

5
42mysqli_rollback

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

5
43mysqli_select_db

This function changes the default database.

5
44mysqli_set_charset

It function sets the default character set.

5
45mysqli_sqlstate

This function returns the SQLSTATE error code for 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 verifies whether the client library is compiled as thread-safe.

5
51mysqli_use_result

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

5
52mysqli_warning_count

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

5
53mysqli_data_seek

It is used to move internal result pointer.

4
54mysqli_fetch all

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

4
55mysqli_fetch array

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

5
56mysqli_fetch_assoc

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

5.3
57mysqli_fetch_field

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

4
58mysqli_fetch_field_direct

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

4
59mysqli_fetch_fields

It is used to returns an array of objects.

4
60mysqli_fetch_lengths

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

4
61mysqli_fetch_object

It returns an object.

5
62mysqli_fetch_row

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

5
63mysqli_field_seek

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

5
64mysqli_field_tell

It returns returns the position of the field cursor.

5
65mysqli_free_result

It frees the memory associated with the result.

5
66mysqli_num_fields

It returns the number of fields in a result set.

5
67mysqli_num_rows

It returns the number of rows in a result set.

5
68mysqli_stmt_sqlstate

It returns the SQLSTATE error from the last statement.

5
69mysqli_stmt_affected_rows

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

5
70mysqli_stmt_attr_get

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

5
71mysqli_stmt_attr_set

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

5
72mysqli_stmt_bind_param

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

5
73mysqli_stmt_bind_result

It binds the columns of a result object to variables.

5
74mysqli_stmt_close

It closes a statement object.

5
75mysqli_stmt_data_seek

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

5
76mysqli_stmt_errno

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

5
77mysqli_stmt_error

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

5
78mysqli_stmt_execute

It executes a statement.

5
79mysqli_stmt_fetch

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

5
80mysqli_stmt_field_count

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

5
81mysqli_stmt_free_result

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

5
82mysqli_stmt_get_result

It returns the result of a statement.

5
83mysqli_stmt_num_rows

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

5
84mysqli_stmt_param_count

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

5
85mysqli_stmt_prepare

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

5
86mysqli_stmt_reset

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

5
87mysqli_stmt_result_metadata

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

5
88mysqli_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
89mysqli_stmt_store_result

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

5

In our subsequent tutorials, we are going to be discussing about the above functions.


Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the mysqli_affected_rows() Function in PHP.

Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain