🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# PHP 5 MySQLi 函数 ## PHP MySQLi 简介 **PHP MySQLi = PHP MySQL Improved!** MySQLi 函数允许您访问 MySQL 数据库服务器。 **注释:**MySQLi 扩展被设计用于 MySQL 4.1.13 版本或更新的版本。 ## 安装 / Runtime 配置 为了能够顺利使用 MySQLi 函数,您必须在编译 PHP 时添加对 MySQLi 扩展的支持。 MySQLi 扩展是在 PHP 5.0.0 版本中引进的。MySQL Native Driver 包含在 PHP 5.3.0 版本。 有关安装的详细信息,请访问: [http://www.php.net/manual/en/mysqli.installation.php](//www.php.net/manual/en/mysqli.installation.php) 有关运行配置的详细信息,请访问: [http://www.php.net/manual/en/mysqli.configuration.php](//www.php.net/manual/en/mysqli.configuration.php) ## PHP 5 MySQLi 函数 | 函数 | 描述 | | --- | --- | | [mysqli_affected_rows()](func-mysqli-affected-rows.html) | 返回前一次 MySQL 操作所影响的记录行数。 | | [mysqli_autocommit()](func-mysqli-autocommit.html) | 打开或关闭自动提交数据库修改。 | | [mysqli_change_user()](func-mysqli-change-user.html) | 更改指定数据库连接的用户。 | | [mysqli_character_set_name()](func-mysqli-character-set-name.html) | 返回数据库连接的默认字符集。 | | [mysqli_close()](func-mysqli-close.html) | 关闭先前打开的数据库连接。 | | [mysqli_commit()](func-mysqli-commit.html) | 提交当前事务。 | | [mysqli_connect_errno()](func-mysqli-connect-errno.html) | 返回上一次连接错误的错误代码。 | | [mysqli_connect_error()](func-mysqli-connect-error.html) | 返回上一次连接错误的错误描述。 | | [mysqli_connect()](func-mysqli-connect.html) | 打开一个到 MySQL 服务器的新的连接。 | | [mysqli_data_seek()](func-mysqli-data-seek.html) | 调整结果指针到结果集中的一个任意行。 | | [mysqli_debug()](func-mysqli-debug.html) | 执行调试操作。 | | [mysqli_dump_debug_info()](func-mysqli-dump-debug-info.html) | 转储调试信息到日志中。 | | [mysqli_errno()](func-mysqli-errno.html) | 返回最近调用函数的最后一个错误代码。 | | [mysqli_error_list()](func-mysqli-error-list.html) | 返回最近调用函数的错误列表。 | | [mysqli_error()](func-mysqli-error.html) | 返回最近调用函数的最后一个错误描述。 | | [mysqli_fetch_all()](func-mysqli-fetch-all.html) | 从结果集中取得所有行作为关联数组,或数字数组,或二者兼有。 | | [mysqli_fetch_array()](func-mysqli-fetch-array.html) | 从结果集中取得一行作为关联数组,或数字数组,或二者兼有。 | | [mysqli_fetch_assoc()](func-mysqli-fetch-assoc.html) | 从结果集中取得一行作为关联数组。 | | [mysqli_fetch_field_direct()](func-mysqli-fetch-field-direct.html) | 从结果集中取得某个单一字段的 meta-data,并作为对象返回。 | | [mysqli_fetch_field()](func-mysqli-fetch-field.html) | 从结果集中取得下一字段,并作为对象返回。 | | [mysqli_fetch_fields()](func-mysqli-fetch-fields.html) | 返回结果中代表字段的对象的数组。 | | [mysqli_fetch_lengths()](func-mysqli-fetch-lengths.html) | 返回结果集中当前行的每个列的长度。 | | [mysqli_fetch_object()](func-mysqli-fetch-object.html) | 从结果集中取得当前行,并作为对象返回。 | | [mysqli_fetch_row()](func-mysqli-fetch-row.html) | 从结果集中取得一行,并作为枚举数组返回。 | | [mysqli_field_count()](func-mysqli-field-count.html) | 返回最近查询的列数。 | | [mysqli_field_seek()](func-mysqli-field-seek.html) | 把结果集中的指针设置为指定字段的偏移量。 | | [mysqli_field_tell()](func-mysqli-field-tell.html) | 返回结果集中的指针的位置。 | | [mysqli_free_result()](func-mysqli-free-result.html) | 释放结果内存。 | | [mysqli_get_charset()](func-mysqli-get-charset.html) | 返回字符集对象。 | | [mysqli_get_client_info()](func-mysqli-get-client-info.html) | 返回 MySQL 客户端库版本。 | | [mysqli_get_client_stats()](func-mysqli-get-client-stats.html) | 返回有关客户端每个进程的统计。 | | [mysqli_get_client_version()](func-mysqli-get-client-version.html) | 将 MySQL 客户端库版本作为整数返回。 | | [mysqli_get_connection_stats()](func-mysqli-get-connection-stats.html) | 返回有关客户端连接的统计。 | | [mysqli_get_host_info()](func-mysqli-get-host-info.html) | 返回 MySQL 服务器主机名和连接类型。 | | [mysqli_get_proto_info()](func-mysqli-get-proto-info.html) | 返回 MySQL 协议版本。 | | [mysqli_get_server_info()](func-mysqli-get-server-info.html) | 返回 MySQL 服务器版本。 | | [mysqli_get_server_version()](func-mysqli-get-server-version.html) | 将 MySQL 服务器版本作为整数返回。 | | [mysqli_info()](func-mysqli-info.html) | 返回有关最近执行查询的信息。 | | [mysqli_init()](func-mysqli-init.html) | 初始化 MySQLi 并返回 mysqli_real_connect() 使用的资源。 | | [mysqli_insert_id()](func-mysqli-insert-id.html) | 返回最后一个查询中自动生成的 ID。 | | [mysql_kill()](func-mysqli-kill.html) | 请求服务器杀死一个 MySQL 线程。 | | [mysqli_more_results()](func-mysqli-more-results.html) | 检查一个多查询是否有更多的结果。 | | [mysqli_multi_query()](func-mysqli-multi-query.html) | 执行一个或多个针对数据库的查询。 | | [mysqli_next_result()](func-mysqli-next-result.html) | 为 mysqli_multi_query() 准备下一个结果集。 | | [mysqli_num_fields()](func-mysqli-num-fields.html) | 返回结果集中字段的数量。 | | [mysqli_num_rows()](func-mysqli-num-rows.html) | 返回结果集中行的数量。 | | [mysqli_options()](func-mysqli-options.html) | 设置额外的连接选项,用于影响连接行为。 | | [mysqli_ping()](func-mysqli-ping.html) | 进行一个服务器连接,如果连接已断开则尝试重新连接。 | | mysqli_prepare() | 准备执行一个 SQL 语句。 | | [mysqli_query()](func-mysqli-query.html) | 执行某个针对数据库的查询。 | | [mysqli_real_connect()](func-mysqli-real-connect.html) | 打开一个到 MySQL 服务器的新的链接。 | | [mysqli_real_escape_string()](func-mysqli-real-escape-string.html) | 转义在 SQL 语句中使用的字符串中的特殊字符。 | | mysqli_real_query() | 执行 SQL 查询 | | mysqli_reap_async_query() | 返回异步查询的结果。 | | [mysqli_refresh()](func-mysqli-refresh.html) | 刷新表或缓存,或者重置复制服务器信息。 | | [mysqli_rollback()](func-mysqli-rollback.html) | 回滚数据库中的当前事务。 | | [mysqli_select_db()](func-mysqli-select-db.html) | 更改连接的默认数据库。 | | [mysqli_set_charset()](func-mysqli-set-charset.html) | 设置默认客户端字符集。 | | mysqli_set_local_infile_default() | 撤销用于 load local infile 命令的用户自定义句柄。 | | mysqli_set_local_infile_handler() | 设置用于 LOAD DATA LOCAL INFILE 命令的回滚函数。 | | [mysqli_sqlstate()](func-mysqli-sqlstate.html) | 返回最后一个 MySQL 操作的 SQLSTATE 错误代码。 | | [mysqli_ssl_set()](func-mysqli-ssl-set.html) | 用于创建 SSL 安全连接。 | | [mysqli_stat()](func-mysqli-stat.html) | 返回当前系统状态。 | | [mysqli_stmt_init()](func-mysqli-stmt-init.html) | 初始化声明并返回 mysqli_stmt_prepare() 使用的对象。 | | mysqli_store_result() | 传输最后一个查询的结果集。 | | [mysqli_thread_id()](func-mysqli-thread-id.html) | 返回当前连接的线程 ID。 | | [mysqli_thread_safe()](func-mysqli-thread-safe.html) | 返回是否将客户端库编译成 thread-safe。 | | mysqli_use_result() | 从上次使用 mysqli_real_query() 执行的查询中初始化结果集的检索。 | | mysqli_warning_count() | 返回连接中的最后一个查询的警告数量。 |