Mysqli 简明教程

MySQLi - Useful Functions

以下是所有重要 MySQLi 函数的列表。每个函数已连同适当的示例一起说明。

Here is the list of all important MySQLi functions. Each function has been explained along with suitable example.

  1. mysqli::$affected_rows − It used to get the information about number of affected rows in a previous MySQL operation

  2. mysqli::autocommit − It used to turn on or off auto-committing database modifications operation

  3. mysqli::begin_transaction − It used to start a transaction

  4. mysqli::change_user − It used to change the user of the specified database connection

  5. mysqli::character_set_name - It returns the default character set for the database connection.

  6. mysqli::$client_info − It is used to get MySQL client info.

  7. mysqli::$client_version − It returns the MySQL client version as a string.

  8. mysqli::close − It closes a previously opened database connection.

  9. mysqli::commit − It commits the current transaction.

  10. mysqli::$connect_errno − It returns the error code from last connect call.

  11. mysqli::connect_error − It returns a string description of the last connect error.

  12. mysqli::__construct − It used to open a new connection to the MySQL server

  13. mysqli::debug − It used to performs debugging operations

  14. mysqli::dump_debug_info − It is used to dump debugging information into the log

  15. mysqli::$errno − It returns the error code for the most recent function call

  16. mysqli::$error_list − It returns a list of errors from the last command executed

  17. mysqli::$error − It returns a string description of the last error

  18. mysqli::$field_count − It returns the number of columns for the most recent query

  19. mysqli::get_charset − It returns a character set object

  20. mysqli::get_client_info − It is used to get MySQL client info

  21. mysqli::mysqli_get_client_stats − It returns client per-process statistics

  22. mysqli::mysqli_get_client_version − It returns the MySQL client version as an integer

  23. mysqli::get_connection_stats − It returns statistics about the client connection

  24. mysqli::$host_info − It returns a string representing the type of connection used

  25. mysqli::$protocol_version − It returns the version of the MySQL protocol used

  26. mysqli::$server_info − It returns the version of the MySQL server

  27. mysqli::$server_version − It returns the version of the MySQL server as an integer

  28. mysqli::get_warnings − It is used to get result of SHOW WARNINGS

  29. mysqli::$info − It retrieves information about the most recently executed query

  30. mysqli::$insert_id − It returns the auto generated id used in the latest query

  31. mysqli::kill − It asks the server to kill a MySQL thread

  32. mysqli::more_results − It used to check if there are any more query results from a multi query

  33. mysqli::multi_query − It performs a query on the database

  34. mysqli::next_result − It prepares next result from multi_query

  35. mysqli::options − It used to set options

  36. mysqli::ping − It is used to ping a server

  37. mysqli::poll − It used to poll connections

  38. mysqli::prepare − It used to prepare an SQL statement for execution.

  39. mysqli::query − It is used to perform a query on the database.

  40. mysqli::real_connect − It opens a connection to a mysql server.

  41. mysqli::real_escape_string − It escapes special characters in a string for use in an SQL statement

  42. mysqli::real_query − It is used to execute an SQL query.

  43. mysqli::real_async_query − It is used to get result from async query

  44. mysqli::refresh − It used to refresh an SQL statement for execution.

  45. mysqli::release_savepoint − It removes the named savepoint from the set of savepoints of the current transaction

  46. mysqli::rollback − It rolls back current transaction

  47. mysqli::rpl_query_type − It returns RPL query type

  48. mysqli::select_db − It is used to selects the default database for database queries

  49. mysqli::send_query − It is used to send the query and return

  50. mysqli::set_charset − It sets the default client character set

  51. mysqli::set_local_infile_default − It is used to unsets user defined handler for load local infile command

  52. mysqli::set_local_infile_handler − It is used to set callback function for LOAD DATA LOCAL INFILE command

  53. mysqli::$sqlstate − It returns the SQLSTATE error from previous MySQL operation.

  54. mysqli::ssl_set − It is used for establishing secure connections using SSL

  55. mysqli::stat − It is used to set callback function for LOAD DATA LOCAL INFILE command

  56. mysqli::stmt_init − It is used to initialize a statement and returns an object for use with mysqli_stmt_prepare.

  57. mysqli::mysqli::$thread_id − It returns the thread ID for the current connection

  58. mysqli::thread_safe − It returns whether thread safety is given or not.

  59. mysqli::use_result − It is used to initiate a result set retrieval

  60. mysqli::$warning_count − It returns the number of warnings from the last query for the given link