<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/set.mysqlinfo.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'book.mysqli.php',
    1 => 'MySQLi',
    2 => 'MySQL增强版扩展',
  ),
  'up' => 
  array (
    0 => 'set.mysqlinfo.php',
    1 => 'MySQL',
  ),
  'prev' => 
  array (
    0 => 'mysqlinfo.concepts.charset.php',
    1 => 'Character sets',
  ),
  'next' => 
  array (
    0 => 'mysqli.overview.php',
    1 => '概述',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/mysqli/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.mysqli.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.mysqli" class="book">
 

 <h1 class="title">MySQL增强版扩展</h1>

 



 <div id="intro.mysqli" class="preface">
  <h1 class="title">简介</h1>
  <p class="para">
   <code class="literal">mysqli</code> 扩展允许访问 MySQL 4.1 及以上版本提供的功能。关于 MySQL
   数据库服务器的更多信息请参阅 <a href="http://www.mysql.com/" class="link external">&raquo;&nbsp;http://www.mysql.com/</a>。
  </p>

  <p class="para">
   可在 <a href="mysqli.overview.php" class="xref">概述</a> 中找到从 PHP 中使用 MySQL 的软件概述。
  </p>

  <p class="para">
  MySQL 的文档请查看 <a href="http://dev.mysql.com/doc/" class="link external">&raquo;&nbsp;http://dev.mysql.com/doc/</a>。
  </p>

  <p class="para">
   本文档中的部分内容摘自 Oracle Corporation 许可的 MySQL 手册。
  </p>
  
  <p class="para">
   示例使用免费提供的 <a href="http://dev.mysql.com/doc/world-setup/en/index.html" class="link external">&raquo;&nbsp;world</a>
   或 <a href="http://dev.mysql.com/doc/sakila/en/index.html" class="link external">&raquo;&nbsp;sakila</a> 数据库。
  </p>

 </div>


 
 





 




 








 






 






 






 







 






 






 






 





 






 






 











<ul class="chunklist chunklist_book"><li><a href="mysqli.overview.php">概述</a></li><li><a href="mysqli.quickstart.php">快速入门指南</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli.quickstart.dual-interface.php">面向过程和面向对象，两种接口</a></li><li><a href="mysqli.quickstart.connections.php">Connections</a></li><li><a href="mysqli.quickstart.statements.php">Executing statements</a></li><li><a href="mysqli.quickstart.prepared-statements.php">Prepared Statements</a></li><li><a href="mysqli.quickstart.stored-procedures.php">Stored Procedures</a></li><li><a href="mysqli.quickstart.multiple-statement.php">Multiple Statements</a></li><li><a href="mysqli.quickstart.transactions.php">API support for transactions</a></li><li><a href="mysqli.quickstart.metadata.php">Metadata</a></li></ul></li><li><a href="mysqli.setup.php">安装/配置</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli.requirements.php">需求</a></li><li><a href="mysqli.installation.php">安装</a></li><li><a href="mysqli.configuration.php">运行时配置</a></li></ul></li><li><a href="mysqli.persistconns.php">mysqli 扩展和持久化连接</a></li><li><a href="mysqli.constants.php">预定义常量</a></li><li><a href="mysqli.notes.php">Notes</a></li><li><a href="mysqli.summary.php">MySQLi 扩展的函数概述</a></li><li><a href="class.mysqli.php">mysqli</a> — mysqli 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli.affected-rows.php">mysqli::$affected_rows</a> — Gets the number of affected rows in a previous MySQL operation</li><li><a href="mysqli.autocommit.php">mysqli::autocommit</a> — 打开或关闭本次数据库连接的自动命令提交事务模式</li><li><a href="mysqli.begin-transaction.php">mysqli::begin_transaction</a> — Starts a transaction</li><li><a href="mysqli.change-user.php">mysqli::change_user</a> — Changes the user of the database connection</li><li><a href="mysqli.character-set-name.php">mysqli::character_set_name</a> — 返回当前数据库连接的字符编码</li><li><a href="mysqli.close.php">mysqli::close</a> — 关闭先前打开的数据库连接</li><li><a href="mysqli.commit.php">mysqli::commit</a> — 提交当前事务</li><li><a href="mysqli.connect-errno.php">mysqli::$connect_errno</a> — Returns the error code from last connect call</li><li><a href="mysqli.connect-error.php">mysqli::$connect_error</a> — Returns a description of the last connection error</li><li><a href="mysqli.construct.php">mysqli::__construct</a> — Open a new connection to the MySQL server</li><li><a href="mysqli.debug.php">mysqli::debug</a> — Performs debugging operations</li><li><a href="mysqli.dump-debug-info.php">mysqli::dump_debug_info</a> — 将调试信息输出到日志</li><li><a href="mysqli.errno.php">mysqli::$errno</a> — 返回最近函数调用的错误代码</li><li><a href="mysqli.error.php">mysqli::$error</a> — Returns a string description of the last error</li><li><a href="mysqli.error-list.php">mysqli::$error_list</a> — Returns a list of errors from the last command executed</li><li><a href="mysqli.execute-query.php">mysqli::execute_query</a> — Prepares, binds parameters, and executes SQL statement</li><li><a href="mysqli.field-count.php">mysqli::$field_count</a> — Returns the number of columns for the most recent query</li><li><a href="mysqli.get-charset.php">mysqli::get_charset</a> — Returns a character set object</li><li><a href="mysqli.get-client-info.php">mysqli::$client_info</a> — 获取 MySQL 客户端信息</li><li><a href="mysqli.get-client-version.php">mysqli::$client_version</a> — 作为整数返回 MySQL 客户端的版本</li><li><a href="mysqli.get-connection-stats.php">mysqli::get_connection_stats</a> — 返回客户端连接的统计数据</li><li><a href="mysqli.get-host-info.php">mysqli::$host_info</a> — 返回表述使用的连接类型的字符串</li><li><a href="mysqli.get-proto-info.php">mysqli::$protocol_version</a> — 返回 MySQL 协议使用的版本号</li><li><a href="mysqli.get-server-info.php">mysqli::$server_info</a> — 返回 MySQL 服务器的版本号</li><li><a href="mysqli.get-server-version.php">mysqli::$server_version</a> — 作为一个整数返回MySQL服务器的版本</li><li><a href="mysqli.get-warnings.php">mysqli::get_warnings</a> — Get result of SHOW WARNINGS</li><li><a href="mysqli.info.php">mysqli::$info</a> — 返回最近执行的 SQL 语句的信息</li><li><a href="mysqli.init.php">mysqli::init</a> — 初始化 MySQLi 并返回用于 mysqli_real_connect() 的对象</li><li><a href="mysqli.insert-id.php">mysqli::$insert_id</a> — 返回上次查询为 AUTO_INCREMENT 列生成的值</li><li><a href="mysqli.kill.php">mysqli::kill</a> — 让服务器杀死一个 MySQL 线程</li><li><a href="mysqli.more-results.php">mysqli::more_results</a> — 检查批量查询中是否还有查询结果</li><li><a href="mysqli.multi-query.php">mysqli::multi_query</a> — 在数据库上执行一个或多个查询</li><li><a href="mysqli.next-result.php">mysqli::next_result</a> — 为读取 multi_query 执行之后的下一个结果集做准备</li><li><a href="mysqli.options.php">mysqli::options</a> — 设置选项</li><li><a href="mysqli.ping.php">mysqli::ping</a> — ping 一个连接，或者如果连接处于断开状态，重新连接</li><li><a href="mysqli.poll.php">mysqli::poll</a> — 轮询连接</li><li><a href="mysqli.prepare.php">mysqli::prepare</a> — 预处理执行 SQL</li><li><a href="mysqli.query.php">mysqli::query</a> — 对数据库执行查询</li><li><a href="mysqli.real-connect.php">mysqli::real_connect</a> — 建立一个 MySQL 服务器连接</li><li><a href="mysqli.real-escape-string.php">mysqli::real_escape_string</a> — 根据当前连接的字符集，对于 SQL 语句中的特殊字符进行转义</li><li><a href="mysqli.real-query.php">mysqli::real_query</a> — 执行一个mysql查询</li><li><a href="mysqli.reap-async-query.php">mysqli::reap_async_query</a> — 获取异步查询的结果</li><li><a href="mysqli.refresh.php">mysqli::refresh</a> — 刷新</li><li><a href="mysqli.release-savepoint.php">mysqli::release_savepoint</a> — 从当前事务的保存点中移除一个命名保存点</li><li><a href="mysqli.rollback.php">mysqli::rollback</a> — 回滚当前事务</li><li><a href="mysqli.savepoint.php">mysqli::savepoint</a> — 在当前事务中设置命名保存点</li><li><a href="mysqli.select-db.php">mysqli::select_db</a> — 选择用于数据库查询的默认数据库</li><li><a href="mysqli.set-charset.php">mysqli::set_charset</a> — 设置客户端字符集</li><li><a href="mysqli.sqlstate.php">mysqli::$sqlstate</a> — 返回上一次 MySQL 操作的 SQLSTATE 错误</li><li><a href="mysqli.ssl-set.php">mysqli::ssl_set</a> — 用于使用 SSL 建立安全连接</li><li><a href="mysqli.stat.php">mysqli::stat</a> — 获取当前系统状态信息</li><li><a href="mysqli.stmt-init.php">mysqli::stmt_init</a> — 初始化语句并返回用于 mysqli_stmt_prepare（调用）的对象</li><li><a href="mysqli.store-result.php">mysqli::store_result</a> — 传输上次查询的结果集</li><li><a href="mysqli.thread-id.php">mysqli::$thread_id</a> — 返回当前连接的线程 ID</li><li><a href="mysqli.thread-safe.php">mysqli::thread_safe</a> — 返回是否线程安全</li><li><a href="mysqli.use-result.php">mysqli::use_result</a> — Initiate a result set retrieval</li><li><a href="mysqli.warning-count.php">mysqli::$warning_count</a> — Returns the number of warnings generated by the most recently executed query</li></ul></li><li><a href="class.mysqli-stmt.php">mysqli_stmt</a> — mysqli_stmt 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli-stmt.affected-rows.php">mysqli_stmt::$affected_rows</a> — Returns the total number of rows changed, deleted, inserted, or
  matched by the last statement executed</li><li><a href="mysqli-stmt.attr-get.php">mysqli_stmt::attr_get</a> — Used to get the current value of a statement attribute</li><li><a href="mysqli-stmt.attr-set.php">mysqli_stmt::attr_set</a> — Used to modify the behavior of a prepared statement</li><li><a href="mysqli-stmt.bind-param.php">mysqli_stmt::bind_param</a> — Binds variables to a prepared statement as parameters</li><li><a href="mysqli-stmt.bind-result.php">mysqli_stmt::bind_result</a> — Binds variables to a prepared statement for result storage</li><li><a href="mysqli-stmt.close.php">mysqli_stmt::close</a> — Closes a prepared statement</li><li><a href="mysqli-stmt.construct.php">mysqli_stmt::__construct</a> — Constructs a new mysqli_stmt object</li><li><a href="mysqli-stmt.data-seek.php">mysqli_stmt::data_seek</a> — Adjusts the result pointer to an arbitrary row in the buffered result</li><li><a href="mysqli-stmt.errno.php">mysqli_stmt::$errno</a> — Returns the error code for the most recent statement call</li><li><a href="mysqli-stmt.error.php">mysqli_stmt::$error</a> — Returns a string description for last statement error</li><li><a href="mysqli-stmt.error-list.php">mysqli_stmt::$error_list</a> — Returns a list of errors from the last statement executed</li><li><a href="mysqli-stmt.execute.php">mysqli_stmt::execute</a> — Executes a prepared statement</li><li><a href="mysqli-stmt.fetch.php">mysqli_stmt::fetch</a> — Fetch results from a prepared statement into the bound variables</li><li><a href="mysqli-stmt.field-count.php">mysqli_stmt::$field_count</a> — Returns the number of columns in the given statement</li><li><a href="mysqli-stmt.free-result.php">mysqli_stmt::free_result</a> — Frees stored result memory for the given statement handle</li><li><a href="mysqli-stmt.get-result.php">mysqli_stmt::get_result</a> — Gets a result set from a prepared statement as a mysqli_result object</li><li><a href="mysqli-stmt.get-warnings.php">mysqli_stmt::get_warnings</a> — Get result of SHOW WARNINGS</li><li><a href="mysqli-stmt.insert-id.php">mysqli_stmt::$insert_id</a> — Get the ID generated from the previous INSERT operation</li><li><a href="mysqli-stmt.more-results.php">mysqli_stmt::more_results</a> — Check if there are more query results from a multiple query</li><li><a href="mysqli-stmt.next-result.php">mysqli_stmt::next_result</a> — Reads the next result from a multiple query</li><li><a href="mysqli-stmt.num-rows.php">mysqli_stmt::$num_rows</a> — Returns the number of rows fetched from the server</li><li><a href="mysqli-stmt.param-count.php">mysqli_stmt::$param_count</a> — Returns the number of parameters for the given statement</li><li><a href="mysqli-stmt.prepare.php">mysqli_stmt::prepare</a> — Prepares an SQL statement for execution</li><li><a href="mysqli-stmt.reset.php">mysqli_stmt::reset</a> — Resets a prepared statement</li><li><a href="mysqli-stmt.result-metadata.php">mysqli_stmt::result_metadata</a> — Returns result set metadata from a prepared statement</li><li><a href="mysqli-stmt.send-long-data.php">mysqli_stmt::send_long_data</a> — Send data in blocks</li><li><a href="mysqli-stmt.sqlstate.php">mysqli_stmt::$sqlstate</a> — Returns SQLSTATE error from previous statement operation</li><li><a href="mysqli-stmt.store-result.php">mysqli_stmt::store_result</a> — Stores a result set in an internal buffer</li></ul></li><li><a href="class.mysqli-result.php">mysqli_result</a> — mysqli_result 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli-result.construct.php">mysqli_result::__construct</a> — Constructs a mysqli_result object</li><li><a href="mysqli-result.current-field.php">mysqli_result::$current_field</a> — Get current field offset of a result pointer</li><li><a href="mysqli-result.data-seek.php">mysqli_result::data_seek</a> — Adjusts the result pointer to an arbitrary row in the result</li><li><a href="mysqli-result.fetch-all.php">mysqli_result::fetch_all</a> — Fetch all result rows as an associative array, a numeric array, or both</li><li><a href="mysqli-result.fetch-array.php">mysqli_result::fetch_array</a> — Fetch the next row of a result set as an associative, a numeric array, or both</li><li><a href="mysqli-result.fetch-assoc.php">mysqli_result::fetch_assoc</a> — Fetch the next row of a result set as an associative array</li><li><a href="mysqli-result.fetch-column.php">mysqli_result::fetch_column</a> — Fetch a single column from the next row of a result set</li><li><a href="mysqli-result.fetch-field.php">mysqli_result::fetch_field</a> — Returns the next field in the result set</li><li><a href="mysqli-result.fetch-field-direct.php">mysqli_result::fetch_field_direct</a> — Fetch meta-data for a single field</li><li><a href="mysqli-result.fetch-fields.php">mysqli_result::fetch_fields</a> — Returns an array of objects representing the fields in a result set</li><li><a href="mysqli-result.fetch-object.php">mysqli_result::fetch_object</a> — Fetch the next row of a result set as an object</li><li><a href="mysqli-result.fetch-row.php">mysqli_result::fetch_row</a> — Fetch the next row of a result set as an enumerated array</li><li><a href="mysqli-result.field-count.php">mysqli_result::$field_count</a> — Gets the number of fields in the result set</li><li><a href="mysqli-result.field-seek.php">mysqli_result::field_seek</a> — Set result pointer to a specified field offset</li><li><a href="mysqli-result.free.php">mysqli_result::free</a> — Frees the memory associated with a result</li><li><a href="mysqli-result.getiterator.php">mysqli_result::getIterator</a> — Retrieve an external iterator</li><li><a href="mysqli-result.lengths.php">mysqli_result::$lengths</a> — Returns the lengths of the columns of the current row in the result set</li><li><a href="mysqli-result.num-rows.php">mysqli_result::$num_rows</a> — Gets the number of rows in the result set</li></ul></li><li><a href="class.mysqli-driver.php">mysqli_driver</a> — mysqli_driver 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli-driver.embedded-server-end.php">mysqli_driver::embedded_server_end</a> — Stop embedded server</li><li><a href="mysqli-driver.embedded-server-start.php">mysqli_driver::embedded_server_start</a> — Initialize and start embedded server</li><li><a href="mysqli-driver.report-mode.php">mysqli_driver::$report_mode</a> — Sets mysqli error reporting mode</li></ul></li><li><a href="class.mysqli-warning.php">mysqli_warning</a> — mysqli_warning 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli-warning.construct.php">mysqli_warning::__construct</a> — Private constructor to disallow direct instantiation</li><li><a href="mysqli-warning.next.php">mysqli_warning::next</a> — Fetch next warning</li></ul></li><li><a href="class.mysqli-sql-exception.php">mysqli_sql_exception</a> — mysqli_sql_exception 类<ul class="chunklist chunklist_book chunklist_children"><li><a href="mysqli-sql-exception.getsqlstate.php">mysqli_sql_exception::getSqlState</a> — Returns the SQLSTATE error code</li></ul></li><li><a href="ref.mysqli.php">别名和过时的 Mysqli 函数</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.mysqli-connect.php">mysqli_connect</a> — 别名 mysqli::__construct</li><li><a href="function.mysqli-escape-string.php">mysqli::escape_string</a> — 别名 mysqli_real_escape_string</li><li><a href="function.mysqli-execute.php">mysqli_execute</a> — 别名 mysqli_stmt_execute</li><li><a href="function.mysqli-get-client-stats.php">mysqli_get_client_stats</a> — 返回客户端进程统计信息</li><li><a href="function.mysqli-get-links-stats.php">mysqli_get_links_stats</a> — 返回打开和缓存的链接相关信息</li><li><a href="function.mysqli-report.php">mysqli_report</a> — 别名 mysqli_driver-&gt;report_mode</li><li><a href="function.mysqli-set-opt.php">mysqli::set_opt</a> — 别名 mysqli_options</li></ul></li><li><a href="changelog.mysqli.php">更新日志</a></li></ul></div><?php manual_footer($setup); ?>