mysqli 函数 bind_result、store_result 和 fetch 之间有什么区别?

What#39;s the difference between the mysqli functions bind_result, store_result and fetch?(mysqli 函数 bind_result、store_result 和 fetch 之间有什么区别?)
本文介绍了mysqli 函数 bind_result、store_result 和 fetch 之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在mysqli_stmt_execute
之后不知道什么时候调用什么,遇到了问题你怎么知道什么时候打电话

I'm running into problems knowing when and what to call after mysqli_stmt_execute
How do you know when to call

  1. mysqli_stmt_bind_result
  2. mysqli_stmt_store_result
  3. mysqli_stmt_fetch

推荐答案

mysqli_stmt_bind_result() 告诉 mysqli 当你获取一行时你想填充哪个变量,但它没有 fetch() 任何东西.在调用 fetch 之前,必须调用一次.

mysqli_stmt_bind_result() tells mysqli which variable you want to be populate when you fetch a row, but it doesn't fetch() anything yet. This is necessary to call once, before you call fetch.

mysqli_stmt_store_result() 设置一个可选行为,以便客户端在您 fetch() 第一行时下载所有行,并将整个结果集缓存在客户端(即 PHP).随后的 fetch() 调用将简单地迭代这个客户端缓存的结果集.但是设置这个选项本身也不会导致 fetch() .此功能完全可选.

mysqli_stmt_store_result() sets an optional behavior so that the client downloads all rows when you fetch() the first row, and caches the whole result set in the client (i.e. PHP). Subsequent fetch() calls will simply iterate over this client-cached result set. But setting this option itself does not cause a fetch() yet either. This function is totally optional.

mysqli_stmt_fetch() 返回结果集中的下一行,并将其存储在绑定变量中.您必须在循环中为结果集的每一行调用此函数.也就是说,直到 fetch 返回 false.

mysqli_stmt_fetch() returns the next row in the result set, and causes it to be stored in a bound variable. You must call this function in a loop, for each row of the result set. That is, until the fetch returns false.

这篇关于mysqli 函数 bind_result、store_result 和 fetch 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)