MySQL and PHP

3.7 The MySQLi Extension Function Summary

Copyright 1997-2021 the PHP Documentation Group.

Table 3.5 Summary of mysqli methods

mysqli Class   
OOP InterfaceProcedural InterfaceAlias (Do not use)Description
Properties   
$mysqli::affected_rowsmysqli_affected_rowsN/AGets the number of affected rows in a previous MySQL operation
$mysqli::client_infomysqli_get_client_infoN/AReturns the MySQL client version as a string
$mysqli::client_versionmysqli_get_client_versionN/AReturns MySQL client version info as an integer
$mysqli::connect_errnomysqli_connect_errnoN/AReturns the error code from last connect call
$mysqli::connect_errormysqli_connect_errorN/AReturns a string description of the last connect error
$mysqli::errnomysqli_errnoN/AReturns the error code for the most recent function call
$mysqli::errormysqli_errorN/AReturns a string description of the last error
$mysqli::field_countmysqli_field_countN/AReturns the number of columns for the most recent query
$mysqli::host_infomysqli_get_host_infoN/AReturns a string representing the type of connection used
$mysqli::protocol_versionmysqli_get_proto_infoN/AReturns the version of the MySQL protocol used
$mysqli::server_infomysqli_get_server_infoN/AReturns the version of the MySQL server
$mysqli::server_versionmysqli_get_server_versionN/AReturns the version of the MySQL server as an integer
$mysqli::infomysqli_infoN/ARetrieves information about the most recently executed query
$mysqli::insert_idmysqli_insert_idN/AReturns the auto generated id used in the last query
$mysqli::sqlstatemysqli_sqlstateN/AReturns the SQLSTATE error from previous MySQL operation
$mysqli::warning_countmysqli_warning_countN/AReturns the number of warnings from the last query for the given link
Methods   
mysqli::autocommitmysqli_autocommitN/ATurns on or off auto-committing database modifications
mysqli::change_usermysqli_change_userN/AChanges the user of the specified database connection
mysqli::character_set_name, mysqli::client_encodingmysqli_character_set_namemysqli_client_encodingReturns the default character set for the database connection
mysqli::closemysqli_closeN/ACloses a previously opened database connection
mysqli::commitmysqli_commitN/ACommits the current transaction
mysqli::__constructmysqli_connectN/AOpen a new connection to the MySQL server [Note: static (i.e. class) method]
mysqli::debugmysqli_debugN/APerforms debugging operations
mysqli::dump_debug_infomysqli_dump_debug_infoN/ADump debugging information into the log
mysqli::get_charsetmysqli_get_charsetN/AReturns a character set object
mysqli::get_connection_statsmysqli_get_connection_statsN/AReturns client connection statistics. Available only with mysqlnd.
mysqli::get_client_infomysqli_get_client_infoN/AReturns the MySQL client version as a string
mysqli::get_client_statsmysqli_get_client_statsN/AReturns client per-process statistics. Available only with mysqlnd.
mysqli::get_server_infomysqli_get_server_infoN/AReturns a string representing the version of the MySQL server that the MySQLi extension is connected to
mysqli::get_warningsmysqli_get_warningsN/ANOT DOCUMENTED
mysqli::initmysqli_initN/AInitializes MySQLi and returns an object for use with mysqli_real_connect.
mysqli::killmysqli_killN/AAsks the server to kill a MySQL thread
mysqli::more_resultsmysqli_more_resultsN/ACheck if there are any more query results from a multi query
mysqli::multi_querymysqli_multi_queryN/APerforms a query on the database
mysqli::next_resultmysqli_next_resultN/APrepare next result from multi_query
mysqli::optionsmysqli_optionsmysqli_set_optSet options
mysqli::pingmysqli_pingN/APings a server connection, or tries to reconnect if the connection has gone down
mysqli::preparemysqli_prepareN/APrepare an SQL statement for execution
mysqli::querymysqli_queryN/APerforms a query on the database
mysqli::real_connectmysqli_real_connectN/AOpens a connection to a mysql server
mysqli::real_escape_string, mysqli::escape_stringmysqli_real_escape_stringmysqli_escape_stringEscapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
mysqli::real_querymysqli_real_queryN/AExecute an SQL query
mysqli::refreshmysqli_refreshN/AFlushes tables or caches, or resets the replication server information
mysqli::rollbackmysqli_rollbackN/ARolls back current transaction
mysqli::select_dbmysqli_select_dbN/ASelects the default database for database queries
mysqli::set_charsetmysqli_set_charsetN/ASets the default client character set
mysqli::ssl_setmysqli_ssl_setN/AUsed for establishing secure connections using SSL
mysqli::statmysqli_statN/AGets the current system status
mysqli::stmt_initmysqli_stmt_initN/AInitializes a statement and returns an object for use with mysqli_stmt_prepare
mysqli::store_resultmysqli_store_resultN/ATransfers a result set from the last query
mysqli::thread_idmysqli_thread_idN/AReturns the thread ID for the current connection
mysqli::thread_safemysqli_thread_safeN/AReturns whether thread safety is given or not
mysqli::use_resultmysqli_use_resultN/AInitiate a result set retrieval

Table 3.6 Summary of mysqli_stmt methods

MySQL_STMT   
OOP InterfaceProcedural InterfaceAlias (Do not use)Description
Properties   
$mysqli_stmt::affected_rowsmysqli_stmt_affected_rowsN/AReturns the total number of rows changed, deleted, or inserted by the last executed statement
$mysqli_stmt::errnomysqli_stmt_errnoN/AReturns the error code for the most recent statement call
$mysqli_stmt::errormysqli_stmt_errorN/AReturns a string description for last statement error
$mysqli_stmt::field_countmysqli_stmt_field_countN/AReturns the number of field in the given statement - not documented
$mysqli_stmt::insert_idmysqli_stmt_insert_idN/AGet the ID generated from the previous INSERT operation
$mysqli_stmt::num_rowsmysqli_stmt_num_rowsN/AReturn the number of rows in statements result set
$mysqli_stmt::param_countmysqli_stmt_param_countmysqli_param_countReturns the number of parameter for the given statement
$mysqli_stmt::sqlstatemysqli_stmt_sqlstateN/AReturns SQLSTATE error from previous statement operation
Methods   
mysqli_stmt::attr_getmysqli_stmt_attr_getN/AUsed to get the current value of a statement attribute
mysqli_stmt::attr_setmysqli_stmt_attr_setN/AUsed to modify the behavior of a prepared statement
mysqli_stmt::bind_parammysqli_stmt_bind_parammysqli_bind_paramBinds variables to a prepared statement as parameters
mysqli_stmt::bind_resultmysqli_stmt_bind_resultmysqli_bind_resultBinds variables to a prepared statement for result storage
mysqli_stmt::closemysqli_stmt_closeN/ACloses a prepared statement
mysqli_stmt::data_seekmysqli_stmt_data_seekN/ASeeks to an arbitrary row in statement result set
mysqli_stmt::executemysqli_stmt_executemysqli_executeExecutes a prepared Query
mysqli_stmt::fetchmysqli_stmt_fetchmysqli_fetchFetch results from a prepared statement into the bound variables
mysqli_stmt::free_resultmysqli_stmt_free_resultN/AFrees stored result memory for the given statement handle
mysqli_stmt::get_resultmysqli_stmt_get_resultN/AGets a result set from a prepared statement. Available only with mysqlnd.
mysqli_stmt::get_warningsmysqli_stmt_get_warningsN/ANOT DOCUMENTED
mysqli_stmt::more_resultsmysqli_stmt_more_resultsN/AChecks if there are more query results from a multiple query
mysqli_stmt::next_resultmysqli_stmt_next_resultN/AReads the next result from a multiple query
mysqli_stmt::num_rowsmysqli_stmt_num_rowsN/ASee also property $mysqli_stmt::num_rows
mysqli_stmt::preparemysqli_stmt_prepareN/APrepare an SQL statement for execution
mysqli_stmt::resetmysqli_stmt_resetN/AResets a prepared statement
mysqli_stmt::result_metadatamysqli_stmt_result_metadatamysqli_get_metadataReturns result set metadata from a prepared statement
mysqli_stmt::send_long_datamysqli_stmt_send_long_datamysqli_send_long_dataSend data in blocks
mysqli_stmt::store_resultmysqli_stmt_store_resultN/ATransfers a result set from a prepared statement

Table 3.7 Summary of mysqli_result methods

mysqli_result   
OOP InterfaceProcedural InterfaceAlias (Do not use)Description
Properties   
$mysqli_result::current_fieldmysqli_field_tellN/AGet current field offset of a result pointer
$mysqli_result::field_countmysqli_num_fieldsN/AGet the number of fields in a result
$mysqli_result::lengthsmysqli_fetch_lengthsN/AReturns the lengths of the columns of the current row in the result set
$mysqli_result::num_rowsmysqli_num_rowsN/AGets the number of rows in a result
Methods   
mysqli_result::data_seekmysqli_data_seekN/AAdjusts the result pointer to an arbitrary row in the result
mysqli_result::fetch_allmysqli_fetch_allN/AFetches all result rows and returns the result set as an associative array, a numeric array, or both. Available only with mysqlnd.
mysqli_result::fetch_arraymysqli_fetch_arrayN/AFetch a result row as an associative, a numeric array, or both
mysqli_result::fetch_assocmysqli_fetch_assocN/AFetch a result row as an associative array
mysqli_result::fetch_field_directmysqli_fetch_field_directN/AFetch meta-data for a single field
mysqli_result::fetch_fieldmysqli_fetch_fieldN/AReturns the next field in the result set
mysqli_result::fetch_fieldsmysqli_fetch_fieldsN/AReturns an array of objects representing the fields in a result set
mysqli_result::fetch_objectmysqli_fetch_objectN/AReturns the current row of a result set as an object
mysqli_result::fetch_rowmysqli_fetch_rowN/AGet a result row as an enumerated array
mysqli_result::field_seekmysqli_field_seekN/ASet result pointer to a specified field offset
mysqli_result::free, mysqli_result::close, mysqli_result::free_resultmysqli_free_resultN/AFrees the memory associated with a result

Table 3.8 Summary of mysqli_driver methods

MySQL_Driver   
OOP InterfaceProcedural InterfaceAlias (Do not use)Description
Properties   
$mysqli_driver::mysqli_reportmysqli_reportN/ASets mysqli error reporting mode
Methods   
mysqli_driver::embedded_server_endmysqli_embedded_server_endN/ANOT DOCUMENTED
mysqli_driver::embedded_server_startmysqli_embedded_server_startN/ANOT DOCUMENTED

Note

Alias functions are provided for backward compatibility purposes only. Do not use them in new projects.